Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f53cbde

Browse files
committedMar 18, 2024
check type conversion of nethttp.DefaultTransport to *nethttp.Transport, return DefaultTransport on fail
fixes #160
1 parent 51c8f26 commit f53cbde

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed
 

‎pipeline.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ func (transport *customTransport) RoundTrip(req *nethttp.Request) (*nethttp.Resp
6060

6161
// GetDefaultTransport returns the default http transport used by the library
6262
func GetDefaultTransport() nethttp.RoundTripper {
63-
defaultTransport := nethttp.DefaultTransport.(*nethttp.Transport).Clone()
63+
defaultTransport, ok := nethttp.DefaultTransport.(*nethttp.Transport)
64+
if !ok {
65+
return nethttp.DefaultTransport
66+
}
67+
defaultTransport = defaultTransport.Clone()
6468
defaultTransport.ForceAttemptHTTP2 = true
6569
defaultTransport.DisableCompression = false
6670
return defaultTransport

0 commit comments

Comments
 (0)
Please sign in to comment.