Skip to content

Commit 2f7dc28

Browse files
Schwobalandlunny
authored andcommitted
add ProxyFromEnvironment if none set (#1096)
1 parent f3bf409 commit 2f7dc28

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

modules/httplib/httplib.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,13 @@ func (r *Request) getResponse() (*http.Response, error) {
303303

304304
if trans == nil {
305305
// create default transport
306+
proxy := r.setting.Proxy
307+
if proxy == nil {
308+
proxy = http.ProxyFromEnvironment
309+
}
306310
trans = &http.Transport{
307311
TLSClientConfig: r.setting.TLSClientConfig,
308-
Proxy: r.setting.Proxy,
312+
Proxy: proxy,
309313
Dial: TimeoutDialer(r.setting.ConnectTimeout, r.setting.ReadWriteTimeout),
310314
}
311315
} else {

0 commit comments

Comments
 (0)