فهرست منبع

Fixed "Multipart Form" section in README.md

Maksimov Sergey 10 سال پیش
والد
کامیت
c7013e4ea2
1فایلهای تغییر یافته به همراه6 افزوده شده و 1 حذف شده
  1. 6 1
      README.md

+ 6 - 1
README.md

@@ -181,7 +181,12 @@ func main() {
 	r.POST("/login", func(c *gin.Context) {
 	r.POST("/login", func(c *gin.Context) {
 
 
 		var form LoginForm
 		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" {
 		if form.User == "user" && form.Password == "password" {
 			c.JSON(200, gin.H{"status": "you are logged in"})
 			c.JSON(200, gin.H{"status": "you are logged in"})