修复相应类型设置错误的BUG
This commit is contained in:
@ -44,7 +44,9 @@ func RequestHandler(uriCfg UriConfig) gin.HandlerFunc {
|
||||
// 格式化验证错误的信息
|
||||
err = GetValidateErr(formValue, err)
|
||||
e = exception.NewFromError(400, err)
|
||||
response.SendWithException(ctx, e, nil)
|
||||
response.SendWithException(ctx, e, nil, &define.ResponseOption{
|
||||
ContentType: "application/json;charset=utf-8",
|
||||
})
|
||||
ctx.Abort()
|
||||
return
|
||||
}
|
||||
@ -97,7 +99,7 @@ func RequestHandler(uriCfg UriConfig) gin.HandlerFunc {
|
||||
if resList[1].IsNil() {
|
||||
// 请求成功
|
||||
isSuccess = true
|
||||
response.Success(ctx, resList[0].Interface())
|
||||
response.SuccessWithExtension(ctx, resList[0].Interface(), &define.ResponseOption{ContentType: "application/json;charset=utf-8"})
|
||||
return
|
||||
}
|
||||
// 请求失败
|
||||
@ -110,7 +112,9 @@ func RequestHandler(uriCfg UriConfig) gin.HandlerFunc {
|
||||
"err": resList[1].Interface(),
|
||||
})
|
||||
}
|
||||
response.SendWithException(ctx, e, nil)
|
||||
response.SendWithException(ctx, e, nil, &define.ResponseOption{
|
||||
ContentType: "application/json;charset=utf-8",
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user