1
0
mirror of https://github.com/gofiber/fiber.git synced 2025-02-19 13:07:52 +00:00

Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Fenny 2020-07-19 13:33:00 +02:00
commit 5dc77f07d2
5 changed files with 12 additions and 5 deletions

2
app.go
View File

@ -594,7 +594,7 @@ func (app *App) init() *App {
if app.Settings != nil {
// Templates is replaced by Views with layout support
if app.Settings.Templates != nil {
fmt.Println("`Templates` are deprecated since v1.12.x, please us `Views` instead")
fmt.Println("`Templates` are deprecated since v1.12.x, please use `Views` instead")
}
// Only load templates if an view engine is specified
if app.Settings.Views != nil {

View File

@ -754,7 +754,7 @@ func Test_App_Listen(t *testing.T) {
utils.AssertEqual(t, nil, app.Shutdown())
}()
utils.AssertEqual(t, nil, app.Listen("4010"))
utils.AssertEqual(t, nil, app.Listen("[::]:4010"))
}
// go test -run Test_App_Listener

2
ctx.go
View File

@ -261,7 +261,7 @@ func (ctx *Ctx) BodyParser(out interface{}) error {
// query params
if ctx.Fasthttp.QueryArgs().Len() > 0 {
schemaDecoder.SetAliasTag("query")
fmt.Println("Parsing query strings using `BodyParser` is deprecated since v1.12.7, please us `ctx.QueryParser` instead")
fmt.Println("Parsing query strings using `BodyParser` is deprecated since v1.12.7, please use `ctx.QueryParser` instead")
data := make(map[string][]string)
ctx.Fasthttp.QueryArgs().VisitAll(func(key []byte, val []byte) {
data[getString(key)] = append(data[getString(key)], getString(val))

View File

@ -23,6 +23,8 @@ import (
"text/template"
"time"
"github.com/valyala/bytebufferpool"
utils "github.com/gofiber/utils"
fasthttp "github.com/valyala/fasthttp"
)
@ -1414,6 +1416,11 @@ func Test_Ctx_Render(t *testing.T) {
err := ctx.Render("./.github/TEST_DATA/template.html", Map{
"Title": "Hello, World!",
})
buf := bytebufferpool.Get()
_, _ = buf.WriteString("overwrite")
defer bytebufferpool.Put(buf)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "<h1>Hello, World!</h1>", string(ctx.Fasthttp.Response.Body()))

View File

@ -28,7 +28,7 @@ func Test_App_Prefork_Child_Process(t *testing.T) {
utils.AssertEqual(t, nil, app.Shutdown())
}()
utils.AssertEqual(t, nil, app.prefork("127.0.0.1:"))
utils.AssertEqual(t, nil, app.prefork("[::]:"))
// Create tls certificate
cer, err := tls.LoadX509KeyPair("./.github/TEST_DATA/ssl.pem", "./.github/TEST_DATA/ssl.key")
@ -57,7 +57,7 @@ func Test_App_Prefork_Master_Process(t *testing.T) {
utils.AssertEqual(t, nil, app.Shutdown())
}()
utils.AssertEqual(t, nil, app.prefork("127.0.0.1:"))
utils.AssertEqual(t, nil, app.prefork(":3000"))
dummyChildCmd = "invalid"