|
@@ -10,11 +10,11 @@ type formBinding struct{}
|
|
|
type formPostBinding struct{}
|
|
type formPostBinding struct{}
|
|
|
type formMultipartBinding struct{}
|
|
type formMultipartBinding struct{}
|
|
|
|
|
|
|
|
-func (_ formBinding) Name() string {
|
|
|
|
|
|
|
+func (formBinding) Name() string {
|
|
|
return "form"
|
|
return "form"
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func (_ formBinding) Bind(req *http.Request, obj interface{}) error {
|
|
|
|
|
|
|
+func (formBinding) Bind(req *http.Request, obj interface{}) error {
|
|
|
if err := req.ParseForm(); err != nil {
|
|
if err := req.ParseForm(); err != nil {
|
|
|
return err
|
|
return err
|
|
|
}
|
|
}
|
|
@@ -25,11 +25,11 @@ func (_ formBinding) Bind(req *http.Request, obj interface{}) error {
|
|
|
return validate(obj)
|
|
return validate(obj)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func (_ formPostBinding) Name() string {
|
|
|
|
|
|
|
+func (formPostBinding) Name() string {
|
|
|
return "form-urlencoded"
|
|
return "form-urlencoded"
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func (_ formPostBinding) Bind(req *http.Request, obj interface{}) error {
|
|
|
|
|
|
|
+func (formPostBinding) Bind(req *http.Request, obj interface{}) error {
|
|
|
if err := req.ParseForm(); err != nil {
|
|
if err := req.ParseForm(); err != nil {
|
|
|
return err
|
|
return err
|
|
|
}
|
|
}
|
|
@@ -39,11 +39,11 @@ func (_ formPostBinding) Bind(req *http.Request, obj interface{}) error {
|
|
|
return validate(obj)
|
|
return validate(obj)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func (_ formMultipartBinding) Name() string {
|
|
|
|
|
|
|
+func (formMultipartBinding) Name() string {
|
|
|
return "multipart/form-data"
|
|
return "multipart/form-data"
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func (_ formMultipartBinding) Bind(req *http.Request, obj interface{}) error {
|
|
|
|
|
|
|
+func (formMultipartBinding) Bind(req *http.Request, obj interface{}) error {
|
|
|
if err := req.ParseMultipartForm(32 << 10); err != nil {
|
|
if err := req.ParseMultipartForm(32 << 10); err != nil {
|
|
|
return err
|
|
return err
|
|
|
}
|
|
}
|