瀏覽代碼

Merge pull request #309 from konjoot/readme-fix

Updated "Multipart Form" section in Readme.md
Manu Mtz.-Almeida 10 年之前
父節點
當前提交
49415b16d5
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      README.md

+ 5 - 1
README.md

@@ -181,7 +181,11 @@ func main() {
 	r.POST("/login", func(c *gin.Context) {
 
 		var form LoginForm
-		c.BindWith(&form, binding.MultipartForm)
+
+		// you can bind multipart form with explicit binding declaration:
+		// c.BindWith(&form, binding.Form)
+		// or you can simply use autobinding with Bind method:
+		c.Bind(&form) // in this case proper binding will be automatically selected
 
 		if form.User == "user" && form.Password == "password" {
 			c.JSON(200, gin.H{"status": "you are logged in"})