set defult支持get
This commit is contained in:
parent
4f1e0e2649
commit
5abd91f947
@ -50,10 +50,10 @@ func (f *form) Parse(ctx *gin.Context, receiver interface{}) error {
|
||||
method == http.MethodTrace ||
|
||||
method == http.MethodConnect ||
|
||||
method == http.MethodOptions {
|
||||
return ctx.ShouldBindQuery(receiver)
|
||||
if err := ctx.ShouldBindQuery(receiver); nil != err {
|
||||
return err
|
||||
}
|
||||
|
||||
if method == http.MethodPost ||
|
||||
} else if method == http.MethodPost ||
|
||||
method == http.MethodPut ||
|
||||
method == http.MethodDelete {
|
||||
if ContentType.IsJson(ctx) {
|
||||
@ -67,6 +67,8 @@ func (f *form) Parse(ctx *gin.Context, receiver interface{}) error {
|
||||
} else {
|
||||
return errors.New(ctx.ContentType() + " is not support")
|
||||
}
|
||||
} else {
|
||||
return errors.New(method + " is not support")
|
||||
}
|
||||
// 设置默认值
|
||||
defaults.SetDefaults(receiver)
|
||||
|
Loading…
Reference in New Issue
Block a user