From a249cbce3d7804fdb25b4431febb9782c44f9e1c Mon Sep 17 00:00:00 2001 From: gangyiwang Date: Fri, 21 May 2021 11:14:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=B9http=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E8=B6=85=E6=97=B6=E5=90=8Eresp=E7=9A=84=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/modules/httpclient/http_client.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/modules/httpclient/http_client.go b/internal/modules/httpclient/http_client.go index afd9c2078..33ff0d305 100644 --- a/internal/modules/httpclient/http_client.go +++ b/internal/modules/httpclient/http_client.go @@ -55,6 +55,10 @@ func request(req *http.Request, timeout int) ResponseWrapper { } setRequestHeader(req) resp, err := client.Do(req) + if resp == nil{ + wrapper.Body = fmt.Sprintf("执行HTTP请求超时") + return wrapper + } if err != nil { wrapper.Body = fmt.Sprintf("执行HTTP请求错误-%s", err.Error()) return wrapper