Add comment for the logic behind func.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2017-01-02 18:01:25 +08:00
parent ebe3580daf
commit aa1a2b75fa
1 changed files with 3 additions and 0 deletions

View File

@ -404,6 +404,9 @@ func main() {
func startPage(c *gin.Context) { func startPage(c *gin.Context) {
var person Person var person Person
// If `GET`, only `Form` binding engine (`query`) used.
// If `POST`, first checks the `content-type` for `JSON` or `XML`, then uses `Form` (`form-data`).
// See more at https://github.com/gin-gonic/gin/blob/develop/binding/binding.go#L45
if c.Bind(&person) == nil { if c.Bind(&person) == nil {
log.Println(person.Name) log.Println(person.Name)
log.Println(person.Address) log.Println(person.Address)