Skip to content

Commit

Permalink
feat: make transport as nil if no proxy.
Browse files Browse the repository at this point in the history
  • Loading branch information
ghosind committed Nov 2, 2023
1 parent 4c17cce commit 46fb8e3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,14 @@ func (cli *Client) defaultValidateStatus(status int) bool {

// getTransport gets the transport by the request options.
func (cli *Client) getTransport(opt RequestOptions) http.RoundTripper {
transport := http.Transport{}
transport.Proxy = cli.getProxy(opt)
proxy := cli.getProxy(opt)
if proxy == nil {
return nil
}

return &transport
return &http.Transport{
Proxy: proxy,
}
}

// getProxy tries to get a proxy by the proxy config from the request options, and it returns
Expand Down

0 comments on commit 46fb8e3

Please sign in to comment.