1
0
mirror of https://github.com/gofiber/fiber.git synced 2025-02-22 23:24:32 +00:00

Merge pull request #290 from Fenny/master

v1.9.2
This commit is contained in:
Fenny 2020-04-24 03:23:03 +02:00 committed by GitHub
commit 541026733d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

3
.github/README.md vendored
View File

@ -24,6 +24,9 @@
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_de.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/de.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_nl.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/nl.svg">
</a>
<a href="https://github.com/gofiber/fiber/blob/master/.github/README_ko.md">
<img height="20px" src="https://github.com/gofiber/docs/blob/master/static/flags/ko.svg">
</a>

4
ctx.go
View File

@ -248,6 +248,7 @@ func (ctx *Ctx) Body(key ...string) string {
}
// Return post value by key
if len(key) > 0 {
fmt.Println("DEPRECATED: c.Body(\"" + key[0] + "\") is deprecated, please use c.FormValue(\"" + key[0] + "\") instead.")
return getString(ctx.Fasthttp.Request.PostArgs().Peek(key[0]))
}
return ""
@ -283,7 +284,7 @@ func (ctx *Ctx) BodyParser(out interface{}) error {
}
return schemaDecoderForm.Decode(out, data.Value)
}
// query Params
// query params
if ctx.Fasthttp.QueryArgs().Len() > 0 {
data := make(map[string][]string)
ctx.Fasthttp.QueryArgs().VisitAll(func(key []byte, val []byte) {
@ -342,6 +343,7 @@ func (ctx *Ctx) Cookie(cookie *Cookie) {
// Cookies is used for getting a cookie value by key
func (ctx *Ctx) Cookies(key ...string) (value string) {
if len(key) == 0 {
fmt.Println("DEPRECATED: c.Cookies() without a key is deprecated, please use c.Get(\"Cookies\") to get the cookie header instead.")
return ctx.Get(HeaderCookie)
}
return getString(ctx.Fasthttp.Request.Header.Cookie(key[0]))