mirror of https://github.com/docker/cli.git
Merge pull request #4427 from thaJeztah/context_inline_vars
cli/context/docker: Endpoint.ClientOpts, withHTTPClient: inline variables
This commit is contained in:
commit
ce9f15c24c
|
@ -100,15 +100,13 @@ func (ep *Endpoint) ClientOpts() ([]client.Opt, error) {
|
||||||
)
|
)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
httpClient := &http.Client{
|
result = append(result,
|
||||||
// No tls
|
client.WithHTTPClient(&http.Client{
|
||||||
// No proxy
|
// No TLS, and no proxy.
|
||||||
Transport: &http.Transport{
|
Transport: &http.Transport{
|
||||||
DialContext: helper.Dialer,
|
DialContext: helper.Dialer,
|
||||||
},
|
},
|
||||||
}
|
}),
|
||||||
result = append(result,
|
|
||||||
client.WithHTTPClient(httpClient),
|
|
||||||
client.WithHost(helper.Host),
|
client.WithHost(helper.Host),
|
||||||
client.WithDialContext(helper.Dialer),
|
client.WithDialContext(helper.Dialer),
|
||||||
)
|
)
|
||||||
|
@ -125,8 +123,7 @@ func withHTTPClient(tlsConfig *tls.Config) func(*client.Client) error {
|
||||||
// Use the default HTTPClient
|
// Use the default HTTPClient
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
return client.WithHTTPClient(&http.Client{
|
||||||
httpClient := &http.Client{
|
|
||||||
Transport: &http.Transport{
|
Transport: &http.Transport{
|
||||||
TLSClientConfig: tlsConfig,
|
TLSClientConfig: tlsConfig,
|
||||||
DialContext: (&net.Dialer{
|
DialContext: (&net.Dialer{
|
||||||
|
@ -135,8 +132,7 @@ func withHTTPClient(tlsConfig *tls.Config) func(*client.Client) error {
|
||||||
}).DialContext,
|
}).DialContext,
|
||||||
},
|
},
|
||||||
CheckRedirect: client.CheckRedirect,
|
CheckRedirect: client.CheckRedirect,
|
||||||
}
|
})(c)
|
||||||
return client.WithHTTPClient(httpClient)(c)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue