do not panic when Client.Transport is not *http.Transport (#3440)

This commit is contained in:
Billie Cleek
2017-10-10 05:46:54 -07:00
committed by Jeff Mitchell
parent 6775fe4927
commit 022e93f627
2 changed files with 23 additions and 3 deletions

View File

@@ -271,9 +271,10 @@ func NewClient(c *Config) (*Client, error) {
c.HttpClient.Transport = cleanhttp.DefaultTransport()
}
tp := c.HttpClient.Transport.(*http.Transport)
if err := http2.ConfigureTransport(tp); err != nil {
return nil, err
if tp, ok := c.HttpClient.Transport.(*http.Transport); ok {
if err := http2.ConfigureTransport(tp); err != nil {
return nil, err
}
}
redirFunc := func() {