optimize code and reduce code cyclomatic complexity (#2737)
* optimize code and reduce code cyclomatic complexity * optimize if-condtion Co-authored-by: thinkerou <thinkerou@gmail.com>
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user