fix: field name "VerifySSL" to "SkipVerifySSL" in Transport config (#305)
This commit is contained in:
parent
859e263815
commit
927bf13ce4
@ -110,15 +110,9 @@ func (n *Notification) setRequestHeader(req *http.Request) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ns *NotificationServerBundle) Send(message string) error {
|
func (ns *NotificationServerBundle) Send(message string) error {
|
||||||
var verifySSL bool
|
var client *http.Client
|
||||||
n := ns.Notification
|
n := ns.Notification
|
||||||
if n.VerifySSL != nil && *n.VerifySSL {
|
if n.VerifySSL != nil && *n.VerifySSL {
|
||||||
verifySSL = true
|
|
||||||
}
|
|
||||||
|
|
||||||
var client *http.Client
|
|
||||||
|
|
||||||
if verifySSL {
|
|
||||||
client = utils.HttpClient
|
client = utils.HttpClient
|
||||||
} else {
|
} else {
|
||||||
client = utils.HttpClientSkipTlsVerify
|
client = utils.HttpClientSkipTlsVerify
|
||||||
|
@ -14,23 +14,23 @@ var (
|
|||||||
func init() {
|
func init() {
|
||||||
HttpClientSkipTlsVerify = httpClient(_httpClient{
|
HttpClientSkipTlsVerify = httpClient(_httpClient{
|
||||||
Transport: httpTransport(_httpTransport{
|
Transport: httpTransport(_httpTransport{
|
||||||
VerifySSL: true,
|
SkipVerifySSL: true,
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
HttpClient = httpClient(_httpClient{
|
HttpClient = httpClient(_httpClient{
|
||||||
Transport: httpTransport(_httpTransport{
|
Transport: httpTransport(_httpTransport{
|
||||||
VerifySSL: false,
|
SkipVerifySSL: false,
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
type _httpTransport struct {
|
type _httpTransport struct {
|
||||||
VerifySSL bool
|
SkipVerifySSL bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func httpTransport(conf _httpTransport) *http.Transport {
|
func httpTransport(conf _httpTransport) *http.Transport {
|
||||||
return &http.Transport{
|
return &http.Transport{
|
||||||
TLSClientConfig: &tls.Config{InsecureSkipVerify: conf.VerifySSL},
|
TLSClientConfig: &tls.Config{InsecureSkipVerify: conf.SkipVerifySSL},
|
||||||
Proxy: http.ProxyFromEnvironment,
|
Proxy: http.ProxyFromEnvironment,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user