add ProxyFromEnvironment if none set (#1096)
This commit is contained in:
parent
f3bf409082
commit
2f7dc28b22
1 changed files with 5 additions and 1 deletions
|
@ -303,9 +303,13 @@ func (r *Request) getResponse() (*http.Response, error) {
|
||||||
|
|
||||||
if trans == nil {
|
if trans == nil {
|
||||||
// create default transport
|
// create default transport
|
||||||
|
proxy := r.setting.Proxy
|
||||||
|
if proxy == nil {
|
||||||
|
proxy = http.ProxyFromEnvironment
|
||||||
|
}
|
||||||
trans = &http.Transport{
|
trans = &http.Transport{
|
||||||
TLSClientConfig: r.setting.TLSClientConfig,
|
TLSClientConfig: r.setting.TLSClientConfig,
|
||||||
Proxy: r.setting.Proxy,
|
Proxy: proxy,
|
||||||
Dial: TimeoutDialer(r.setting.ConnectTimeout, r.setting.ReadWriteTimeout),
|
Dial: TimeoutDialer(r.setting.ConnectTimeout, r.setting.ReadWriteTimeout),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue