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

solve NewRegistry httpclient 'nil pointer dereference' bug

This commit is contained in:
shuxian 2019-02-28 09:56:57 +08:00
parent b8f20924cc
commit d3f447a732

View File

@ -105,12 +105,13 @@ func configure(c *consulRegistry, opts ...registry.Option) {
}
}
if config.HttpClient == nil {
config.HttpClient = new(http.Client)
}
// requires secure connection?
if c.opts.Secure || c.opts.TLSConfig != nil {
if config.HttpClient == nil {
config.HttpClient = new(http.Client)
}
config.Scheme = "https"
// We're going to support InsecureSkipVerify
config.HttpClient.Transport = newTransport(c.opts.TLSConfig)