修复RPC请求结果处理的BUG

This commit is contained in:
白茶清欢 2022-09-03 19:37:26 +08:00
parent eb2302301f
commit 27e02a3570

5
rpc.go
View File

@ -332,6 +332,11 @@ func (r *request) Send(ctx *gin.Context, serviceFlag string, apiFlag string, par
if !r.codeIsSuccess(code, successBusinessCodeList) {
return fmt.Errorf("业务状态码异常 : %v -> %v", code, message)
}
if nil == receiver {
// 数据接收指针为 nil , 则认为状态码为成功既是成功
return nil
}
if err = parseResponseBody(response.Header.Get("Content-Type"), []byte(data), receiver); nil != err {
logDataList = append(logDataList, zap.Any("response_body_parse_fail_reason", err.Error()))
}