mirror of
https://github.com/silenceper/wechat.git
synced 2026-02-04 12:52:27 +08:00
fix panic (#844)
This commit is contained in:
@@ -291,7 +291,14 @@ func httpWithTLS(rootCa, key string) (*http.Client, error) {
|
||||
config := &tls.Config{
|
||||
Certificates: []tls.Certificate{cert},
|
||||
}
|
||||
trans := (DefaultHTTPClient.Transport.(*http.Transport)).Clone()
|
||||
|
||||
var baseTransport http.RoundTripper
|
||||
if DefaultHTTPClient.Transport != nil {
|
||||
baseTransport = DefaultHTTPClient.Transport
|
||||
} else {
|
||||
baseTransport = http.DefaultTransport
|
||||
}
|
||||
trans := baseTransport.(*http.Transport).Clone()
|
||||
trans.TLSClientConfig = config
|
||||
trans.DisableCompression = true
|
||||
client = &http.Client{Transport: trans}
|
||||
|
||||
Reference in New Issue
Block a user