Skip to content

Commit

Permalink
feat(http/driver): added ConfigureTransport
Browse files Browse the repository at this point in the history
  • Loading branch information
bundleman committed Oct 7, 2023
1 parent 36d1210 commit b7af4a9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pkg/drivers/http/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"compress/flate"
"compress/gzip"
"context"
"golang.org/x/net/http2"
"io"
"io/ioutil"
"net/http"
Expand Down Expand Up @@ -81,9 +82,14 @@ func addProxy(httpClient *pester.Client, proxyStr string) error {
proxy := http.ProxyURL(proxyURL)

if httpClient.Transport != nil {
transport, isHTTPTransport := httpClient.Transport.(*http.Transport)
if isHTTPTransport {
transport.Proxy = proxy
if _, isHTTPTransport := httpClient.Transport.(*http.Transport); isHTTPTransport {
httpClient.Transport.(*http.Transport).Proxy = proxy
}

if _, isHTTPTransport := httpClient.Transport.(*http2.Transport); isHTTPTransport {
httpTr1 := &http.Transport{}
httpTr1.Proxy = proxy
http2.ConfigureTransport(httpTr1)
}

return nil
Expand Down

0 comments on commit b7af4a9

Please sign in to comment.