Skip to content

Commit

Permalink
network InsecureSkipVerify
Browse files Browse the repository at this point in the history
  • Loading branch information
trheyi committed Jan 12, 2022
1 parent ee50523 commit 5d600f2
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion network/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package network

import (
"bytes"
"crypto/tls"
"fmt"
"io/ioutil"
"net/http"
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 5d600f2

Please sign in to comment.