typeUserstruct{Namestring`form:"name,default=user1" json:"name,default=user2"`Ageint`form:"age,default=10" json:"age,default=20"`}r:=gin.Default()// way1 curl 127.0.0.1:8900/bind?name=aa
// way2 curl -X POST 127.0.0.1:8900/bind -d "name=aa&age=30"
// way3 curl -X POST 127.0.0.1:8900/bind -H "Content-Type: application/json" -d "{\"name\": \"aa\"}"
r.Any("/bind",func(c*gin.Context){varuserUser//user = User{Name: "bb", Age: 11} //way4:A variable of type User can be generated with the default value before bind
ifc.ContentType()==binding.MIMEJSON{//way5:A variable of type User can be generated with the default value before bind.
_=binding.MapFormWithTag(&user,nil,"json")}_=c.Bind(&user)//Note that because bind is used here to request json, you specify the Content-Type header
c.String(200,"Hello %v age %v",user.Name,user.Age)})// The above 4 way.
// way1/2 structTag is work.because gin at queryBinding/formBinding execute mapFormByTag logic, will check formTag
// way3 structTag not work. gin at jsonBinding non-execution mapFormByTag logic
// way4/way5 no matter query/form/json All valid
// way5 is work. Because the mapFormByTag logic is triggered in addition
r.Run(":8900")