From 5d600f268414953701ccc627430a12ac2e99bb51 Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 12 Jan 2022 15:37:45 +0800 Subject: [PATCH] network InsecureSkipVerify --- network/request.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/network/request.go b/network/request.go index 9bec3dcf..3e8d23c8 100644 --- a/network/request.go +++ b/network/request.go @@ -2,6 +2,7 @@ package network import ( "bytes" + "crypto/tls" "fmt" "io/ioutil" "net/http" @@ -93,7 +94,18 @@ func RequestSend(method string, url string, params map[string]interface{}, data } } - resp, err := (&http.Client{}).Do(req) + // Https + var client *http.Client = &http.Client{} + + // SkipVerify false + if strings.HasPrefix(url, "https://") { + tr := &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + } + client = &http.Client{Transport: tr} + } + + resp, err := client.Do(req) if err != nil { return Response{ Status: 0,