瀏覽代碼

Merge pull request #780 from gin-gonic/patch-4

Add comment for the logic behind func.
Javier Provecho Fernandez 9 年之前
父節點
當前提交
565e1e0c87
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      README.md

+ 3 - 0
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)