From e5ff8dcdf38160afd92da22d92b457e70e316321 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Tue, 14 Feb 2023 15:32:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=93=8D=E5=BA=94=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=20->=20receiver=E7=9A=84=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- httpclient.go | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/httpclient.go b/httpclient.go index bb8a347..10f75c9 100644 --- a/httpclient.go +++ b/httpclient.go @@ -38,12 +38,11 @@ type httpClient struct { // Author : go_developer@163.com<白茶清欢> // // Date : 14:37 2023/2/14 -func (hc *httpClient) Send(requestURL string, method string, header map[string]string, param map[string]interface{}, options httpclient.Map, receiver interface{}) ([]byte, error) { +func (hc *httpClient) Send(requestURL string, method string, header map[string]string, param map[string]interface{}, options httpclient.Map) ([]byte, error) { var ( - err error - response *httpclient.Response - c *httpclient.HttpClient - responseData []byte + err error + response *httpclient.Response + c *httpclient.HttpClient ) if nil == param { param = make(map[string]interface{}) @@ -65,17 +64,7 @@ func (hc *httpClient) Send(requestURL string, method string, header map[string]s return nil, fmt.Errorf("%v : %v", response.StatusCode, response.Status) } - if responseData, err = hc.getResponseBody(response); nil != err { - return nil, err - } - - if nil == receiver { - return responseData, nil - } - if err = json.Unmarshal(responseData, receiver); nil != err { - return responseData, err - } - return responseData, err + return hc.getResponseBody(response) } // getResponseBody ...