gin/binding
guonaihong 8ee9d959a0 Now you can parse the inline lowercase start structure (#1893)
* Now you can parse the inline lowercase start structure

package main

import (
	"encoding/json"
	"fmt"
	"github.com/gin-gonic/gin"
)

type appkey struct {
	Appkey string `json:"appkey" form:"appkey"`
}

type Query struct {
	Page int `json:"page" form:"page"`
	Size int `json:"size" form:"size"`
	appkey
}

func main() {

	router := gin.Default()
	router.POST("/login", func(c *gin.Context) {

		var q2 Query

		if c.ShouldBindQuery(&q2) == nil {
			c.JSON(200, &q2)
		}
	})
	router.Run(":8088")
}

http client:

old:
curl -X POST "127.0.0.1:8088/login?appkey=china&page=1&size=10"
{"page":1,"size":10,"appkey":""}

now:
curl -X POST "127.0.0.1:8088/login?appkey=china&page=1&size=10"
{"page":1,"size":10,"appkey":"china"}

* Modify judgment conditions
2019-05-13 10:17:31 +08:00
..
binding_body_test.go Yaml binding (#1618) 2018-11-06 09:49:45 +08:00
binding_test.go Now you can parse the inline lowercase start structure (#1893) 2019-05-13 10:17:31 +08:00
binding.go update for supporting file binding (#1264) 2019-03-18 10:16:34 +08:00
default_validator.go update error(err) to err (#1416) 2018-07-01 21:10:48 +08:00
form_mapping_benchmark_test.go refactor(form_mapping.go): mapping ptr, struct and map (#1749) 2019-03-03 14:39:43 +08:00
form_mapping_test.go binding: move tests of mapping to separate test file (#1842) 2019-05-07 19:06:55 +08:00
form_mapping.go Now you can parse the inline lowercase start structure (#1893) 2019-05-13 10:17:31 +08:00
form.go refactor(form_mapping.go): mapping multipart request (#1829) 2019-04-02 09:01:34 +08:00
json.go handle nil body for JSON binding (#1638) 2018-11-22 09:55:51 +08:00
msgpack.go Fix #216: Enable to call binding multiple times in some formats (#1341) 2018-05-11 10:33:33 +08:00
protobuf.go Fix typos (#1626) 2018-11-05 14:17:04 +08:00
query.go style(import): not use aliase when import package (#1146) 2017-10-29 13:12:22 +01:00
uri.go support bind uri param (#1612) 2018-11-22 09:29:48 +08:00
validate_test.go unify assert.Equal usage (#1327) 2018-04-20 10:27:44 +08:00
xml.go Fix #216: Enable to call binding multiple times in some formats (#1341) 2018-05-11 10:33:33 +08:00
yaml.go Yaml binding (#1618) 2018-11-06 09:49:45 +08:00