From aa1a2b75fafe8fa2d25647da228fda4fa82f8f67 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Mon, 2 Jan 2017 18:01:25 +0800 Subject: [PATCH] Add comment for the logic behind func. Signed-off-by: Bo-Yi Wu --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 49345648..19d9088b 100644 --- a/README.md +++ b/README.md @@ -404,6 +404,9 @@ func main() { func startPage(c *gin.Context) { 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 { log.Println(person.Name) log.Println(person.Address)