From cdf26f994bb551da109f4e4b8f206d8db4fdb354 Mon Sep 17 00:00:00 2001 From: George Kirilenko Date: Mon, 4 Sep 2017 04:15:50 +0300 Subject: [PATCH] 32 << 10 != 32 Mb (#1094) --- binding/form.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/binding/form.go b/binding/form.go index 557333e..0be5966 100644 --- a/binding/form.go +++ b/binding/form.go @@ -6,6 +6,8 @@ package binding import "net/http" +const defaultMemory = 32 * 1024 * 1024 + type formBinding struct{} type formPostBinding struct{} type formMultipartBinding struct{} @@ -18,7 +20,7 @@ func (formBinding) Bind(req *http.Request, obj interface{}) error { if err := req.ParseForm(); err != nil { return err } - req.ParseMultipartForm(32 << 10) // 32 MB + req.ParseMultipartForm(defaultMemory) if err := mapForm(obj, req.Form); err != nil { return err } @@ -44,7 +46,7 @@ func (formMultipartBinding) Name() string { } 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 } if err := mapForm(obj, req.MultipartForm.Value); err != nil {