From 27e02a3570f8ac2db5839e897bf6a09512c69ef7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Sat, 3 Sep 2022 19:37:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DRPC=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=E5=A4=84=E7=90=86=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rpc.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rpc.go b/rpc.go index 01d54de..cd40a6a 100644 --- a/rpc.go +++ b/rpc.go @@ -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())) }