From 8a47763644691126f5f56bd5db0d073072650c4f Mon Sep 17 00:00:00 2001 From: tylitianrui Date: Tue, 25 May 2021 13:13:35 +0800 Subject: [PATCH] optimize if-condtion --- binding/form.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/binding/form.go b/binding/form.go index b93c34cf..040af9e2 100644 --- a/binding/form.go +++ b/binding/form.go @@ -22,10 +22,8 @@ func (formBinding) Bind(req *http.Request, obj interface{}) error { if err := req.ParseForm(); err != nil { return err } - if err := req.ParseMultipartForm(defaultMemory); err != nil { - if err != http.ErrNotMultipart { - return err - } + if err := req.ParseMultipartForm(defaultMemory); err != nil && err != http.ErrNotMultipart { + return err } if err := mapForm(obj, req.Form); err != nil { return err