1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-11-24 08:02:32 +02:00

Check for uninitialized *config.HttpClient

This commit is contained in:
Sergey Sarbash 2017-08-15 10:49:24 +03:00
parent fd01ead575
commit db0df07fd6

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)
}