From 4da6028308f5c80d0ad944e29a0867e243590465 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 22:27:24 +0800 Subject: [PATCH] handle err --- httpclient.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/httpclient.go b/httpclient.go index d2c0857..dc46c25 100644 --- a/httpclient.go +++ b/httpclient.go @@ -84,6 +84,10 @@ func (hc *httpClient) Send(requestURL string, method string, header map[string]s default: return nil, errors.New(method + " is not invalid") } + if nil != err { + return nil, errors.New(" request send fail : " + err.Error()) + } + if response.StatusCode != http.StatusOK { return nil, fmt.Errorf("%v : %v", response.StatusCode, response.Status) }