Properly set transport
This commit is contained in:
@@ -38,8 +38,8 @@ func (r *HTTPClient) Do(req *http.Request) (*http.Response, error) {
|
||||
|
||||
if r.config.ShouldForceIPv6() {
|
||||
dialer := &net.Dialer{}
|
||||
transport := &http.Transport{
|
||||
DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||
transport := r.Client.Transport.(*http.Transport).Clone()
|
||||
transport.DialContext = func(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||
host, port, err := net.SplitHostPort(addr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -66,7 +66,6 @@ func (r *HTTPClient) Do(req *http.Request) (*http.Response, error) {
|
||||
addr = net.JoinHostPort(ipv6.String(), port)
|
||||
}
|
||||
return dialer.DialContext(ctx, network, addr)
|
||||
},
|
||||
}
|
||||
r.Client.Transport = transport
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user