32 << 10 != 32 Mb (#1094)
This commit is contained in:
parent
ab50cf9790
commit
cdf26f994b
@ -6,6 +6,8 @@ package binding
|
|||||||
|
|
||||||
import "net/http"
|
import "net/http"
|
||||||
|
|
||||||
|
const defaultMemory = 32 * 1024 * 1024
|
||||||
|
|
||||||
type formBinding struct{}
|
type formBinding struct{}
|
||||||
type formPostBinding struct{}
|
type formPostBinding struct{}
|
||||||
type formMultipartBinding struct{}
|
type formMultipartBinding struct{}
|
||||||
@ -18,7 +20,7 @@ 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
|
||||||
}
|
}
|
||||||
req.ParseMultipartForm(32 << 10) // 32 MB
|
req.ParseMultipartForm(defaultMemory)
|
||||||
if err := mapForm(obj, req.Form); err != nil {
|
if err := mapForm(obj, req.Form); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -44,7 +46,7 @@ func (formMultipartBinding) Name() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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(defaultMemory); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := mapForm(obj, req.MultipartForm.Value); err != nil {
|
if err := mapForm(obj, req.MultipartForm.Value); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user