Merge pull request #197 from sarbash/fix-tls-consul-registry

Check for uninitialized *config.HttpClient
This commit is contained in:
Asim Aslam 2017-08-15 08:51:50 +01:00 committed by GitHub
commit e3f818d18e

View File

@ -59,6 +59,9 @@ func newConsulRegistry(opts ...Option) Registry {
config = c
}
}
if config.HttpClient == nil {
config.HttpClient = new(http.Client)
}
// set timeout
if options.Timeout > 0 {
@ -81,9 +84,6 @@ func newConsulRegistry(opts ...Option) Registry {
if options.Secure || options.TLSConfig != nil {
config.Scheme = "https"
// We're going to support InsecureSkipVerify
if config.HttpClient == nil {
config.HttpClient = new(http.Client)
}
config.HttpClient.Transport = newTransport(options.TLSConfig)
}