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.MethodTrace ||
|
||||||
method == http.MethodConnect ||
|
method == http.MethodConnect ||
|
||||||
method == http.MethodOptions {
|
method == http.MethodOptions {
|
||||||
return ctx.ShouldBindQuery(receiver)
|
if err := ctx.ShouldBindQuery(receiver); nil != err {
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
} else if method == http.MethodPost ||
|
||||||
if method == http.MethodPost ||
|
|
||||||
method == http.MethodPut ||
|
method == http.MethodPut ||
|
||||||
method == http.MethodDelete {
|
method == http.MethodDelete {
|
||||||
if ContentType.IsJson(ctx) {
|
if ContentType.IsJson(ctx) {
|
||||||
@ -67,6 +67,8 @@ func (f *form) Parse(ctx *gin.Context, receiver interface{}) error {
|
|||||||
} else {
|
} else {
|
||||||
return errors.New(ctx.ContentType() + " is not support")
|
return errors.New(ctx.ContentType() + " is not support")
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return errors.New(method + " is not support")
|
||||||
}
|
}
|
||||||
// 设置默认值
|
// 设置默认值
|
||||||
defaults.SetDefaults(receiver)
|
defaults.SetDefaults(receiver)
|
||||||
|
Loading…
Reference in New Issue
Block a user