修复相应类型设置错误的BUG
This commit is contained in:
@ -95,7 +95,7 @@ func Send(ctx *gin.Context, code any, httpCode int, data any, responseOption *de
|
||||
responseContentType := getResponseDataType(responseOption.ContentType)
|
||||
responseInstance, _ := wrapper.NewJson(serialize.JSON.MarshalForStringIgnoreError(responseException.GetData()), &wrapper.Option{XmlName: responseOption.XmlName})
|
||||
finalResponseData, _ := responseInstance.Marshal(responseContentType)
|
||||
ctx.Data(responseException.GetHttpCode(), responseContentType, finalResponseData)
|
||||
ctx.Data(responseException.GetHttpCode(), responseOption.ContentType, finalResponseData)
|
||||
}
|
||||
|
||||
// getResponseDataType 获取相应数据类型
|
||||
@ -138,7 +138,7 @@ func SendWithStatusOK(ctx *gin.Context, code any, data any) {
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 13:08 2022/6/26
|
||||
func SendWithException(ctx *gin.Context, e exception.IException, data map[string]any) {
|
||||
func SendWithException(ctx *gin.Context, e exception.IException, data map[string]any, responseOption *define.ResponseOption) {
|
||||
if nil == e {
|
||||
e = exception.NewSuccess(data)
|
||||
}
|
||||
@ -152,7 +152,7 @@ func SendWithException(ctx *gin.Context, e exception.IException, data map[string
|
||||
"e_data": e.GetData(),
|
||||
"u_e_data": data,
|
||||
}
|
||||
Send(ctx, e.GetCode(), e.GetHttpCode(), outputData, nil)
|
||||
Send(ctx, e.GetCode(), e.GetHttpCode(), outputData, responseOption)
|
||||
}
|
||||
|
||||
// JSON ctx.JSON 的平替, 增加了数据是否已相应的标识
|
||||
|
Reference in New Issue
Block a user