fix(binding): binding error while not upload file (#3819) (#3820)

Co-authored-by: zhangmj <zhangmj1@dustess.com>
This commit is contained in:
clearcode
2024-02-05 10:46:35 +08:00
committed by GitHub
parent 9f598a31aa
commit 3dc1cd6572
2 changed files with 5 additions and 0 deletions

View File

@ -7,6 +7,7 @@ package binding
import (
"errors"
"fmt"
"mime/multipart"
"reflect"
"strconv"
"strings"
@ -235,6 +236,8 @@ func setWithProperType(val string, value reflect.Value, field reflect.StructFiel
switch value.Interface().(type) {
case time.Time:
return setTimeField(val, field, value)
case multipart.FileHeader:
return nil
}
return json.Unmarshal(bytesconv.StringToBytes(val), value.Addr().Interface())
case reflect.Map: