Skip to content

Commit e3f818d

Browse files
author
Asim Aslam
authored
Merge pull request #197 from sarbash/fix-tls-consul-registry
Check for uninitialized *config.HttpClient
2 parents 87c3954 + db0df07 commit e3f818d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

registry/consul_registry.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ func newConsulRegistry(opts ...Option) Registry {
5959
config = c
6060
}
6161
}
62+
if config.HttpClient == nil {
63+
config.HttpClient = new(http.Client)
64+
}
6265

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

0 commit comments

Comments
 (0)