mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-18 23:12:17 +08:00
fix bug that tag form:",default=1"
are not effective in some cases, e.g: http://host/list?page_no=&page_size=
This commit is contained in:
parent
4427ca4a60
commit
0d78d80836
@ -163,8 +163,10 @@ func setByForm(value reflect.Value, field reflect.StructField, form map[string][
|
|||||||
val = opt.defaultValue
|
val = opt.defaultValue
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(vs) > 0 {
|
if len(vs) > 0 && vs[0] != "" {
|
||||||
val = vs[0]
|
val = vs[0]
|
||||||
|
} else {
|
||||||
|
val = opt.defaultValue
|
||||||
}
|
}
|
||||||
return true, setWithProperType(val, value, field)
|
return true, setWithProperType(val, value, field)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user