mirror of
https://github.com/gofiber/fiber.git
synced 2025-02-22 19:03:50 +00:00
Update test
This commit is contained in:
parent
b4ffb82493
commit
b4244de892
4
ctx.go
4
ctx.go
@ -743,9 +743,9 @@ func (ctx *Ctx) Render(name string, bind interface{}) (err error) {
|
||||
buf := bytebufferpool.Get()
|
||||
defer bytebufferpool.Put(buf)
|
||||
|
||||
// Use ViewEngine if exist
|
||||
// Use Templates engine if exist
|
||||
if ctx.app.Settings.Templates != nil {
|
||||
// Render template from ViewEngine
|
||||
// Render template from Engine
|
||||
if err := ctx.app.Settings.Templates.Render(buf, name, bind); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -893,7 +893,7 @@ func Test_Ctx_Download(t *testing.T) {
|
||||
|
||||
expect, err := ioutil.ReadAll(f)
|
||||
utils.AssertEqual(t, nil, err)
|
||||
utils.AssertEqual(t, true, bytes.Equal(expect, ctx.Fasthttp.Response.Body()))
|
||||
utils.AssertEqual(t, expect, ctx.Fasthttp.Response.Body())
|
||||
}
|
||||
|
||||
// go test -run Test_Ctx_JSON
|
||||
|
@ -2,7 +2,6 @@ package middleware
|
||||
|
||||
import (
|
||||
"github.com/gofiber/fiber"
|
||||
"github.com/gofiber/utils"
|
||||
)
|
||||
|
||||
// Middleware types
|
||||
@ -33,14 +32,6 @@ type (
|
||||
// Helmet helps secure your apps by setting various HTTP headers
|
||||
func Helmet() fiber.Handler {
|
||||
return func(ctx *fiber.Ctx) {
|
||||
// Get id from request
|
||||
rid := ctx.Get(fiber.HeaderXRequestID)
|
||||
// Create new UUID if empty
|
||||
if len(rid) <= 0 {
|
||||
rid = utils.UUID()
|
||||
}
|
||||
// Set new id to response
|
||||
ctx.Set(fiber.HeaderXRequestID, rid)
|
||||
// Continue stack
|
||||
ctx.Next()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user