修复相应类型设置错误的BUG

This commit is contained in:
2025-04-29 14:40:04 +08:00
parent 0bd02dbd08
commit 146fbaf878
2 changed files with 10 additions and 6 deletions

View File

@ -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
}
}