From 6092d2c2cc80936306687b8441083453939cee4f Mon Sep 17 00:00:00 2001 From: Kyle Havlovitz Date: Wed, 24 May 2017 13:45:19 -0700 Subject: [PATCH] Don't overwrite Transport's TLS config if it's been set --- api/api.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/api/api.go b/api/api.go index 1353979df..6f90ed5d6 100644 --- a/api/api.go +++ b/api/api.go @@ -430,17 +430,20 @@ func NewClient(config *Config) (*Client, error) { // NewHttpClient returns an http client configured with the given Transport and TLS // config. func NewHttpClient(transport *http.Transport, tlsConf TLSConfig) (*http.Client, error) { - tlsClientConfig, err := SetupTLSConfig(&tlsConf) - - if err != nil { - return nil, err - } - - transport.TLSClientConfig = tlsClientConfig client := &http.Client{ Transport: transport, } + if transport.TLSClientConfig == nil { + tlsClientConfig, err := SetupTLSConfig(&tlsConf) + + if err != nil { + return nil, err + } + + transport.TLSClientConfig = tlsClientConfig + } + return client, nil }