From 46c13b51851374b445ed0458c321808bd83e8869 Mon Sep 17 00:00:00 2001 From: Lee Tang Date: Sat, 31 Oct 2020 10:03:41 +0800 Subject: [PATCH] Restore the ability to use a proxy for all HTTP requests The default transport was changed in commit 0d66f2c and the proxy feature was forgotten. - https://golang.org/src/net/http/transport.go#L43 - https://golang.org/pkg/net/http/#ProxyFromEnvironment --- http/client/client.go | 1 + 1 file changed, 1 insertion(+) diff --git a/http/client/client.go b/http/client/client.go index 4d91b3e8..eb889d8e 100644 --- a/http/client/client.go +++ b/http/client/client.go @@ -268,6 +268,7 @@ func (c *Client) buildRequest(method string, body io.Reader) (*http.Request, err func (c *Client) buildClient() http.Client { client := http.Client{Timeout: time.Duration(c.ClientTimeout) * time.Second} transport := &http.Transport{ + Proxy: http.ProxyFromEnvironment, DialContext: (&net.Dialer{ // Default is 30s. Timeout: 10 * time.Second,