Check for uninitialized *config.HttpClient
This commit is contained in:
parent
fd01ead575
commit
db0df07fd6
@ -59,6 +59,9 @@ func newConsulRegistry(opts ...Option) Registry {
|
|||||||
config = c
|
config = c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if config.HttpClient == nil {
|
||||||
|
config.HttpClient = new(http.Client)
|
||||||
|
}
|
||||||
|
|
||||||
// set timeout
|
// set timeout
|
||||||
if options.Timeout > 0 {
|
if options.Timeout > 0 {
|
||||||
@ -81,9 +84,6 @@ func newConsulRegistry(opts ...Option) Registry {
|
|||||||
if options.Secure || options.TLSConfig != nil {
|
if options.Secure || options.TLSConfig != nil {
|
||||||
config.Scheme = "https"
|
config.Scheme = "https"
|
||||||
// We're going to support InsecureSkipVerify
|
// We're going to support InsecureSkipVerify
|
||||||
if config.HttpClient == nil {
|
|
||||||
config.HttpClient = new(http.Client)
|
|
||||||
}
|
|
||||||
config.HttpClient.Transport = newTransport(options.TLSConfig)
|
config.HttpClient.Transport = newTransport(options.TLSConfig)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user