From cbb5f9d1bc1b04764791d2b8cb1ac7402dd962cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillaume=20Gr=C3=A9sillion?= Date: Fri, 19 Dec 2025 14:32:42 +0100 Subject: [PATCH] fix(httpx): handle transports other than http.Transport --- httpx/client.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/httpx/client.go b/httpx/client.go index d8728e7..9e49001 100644 --- a/httpx/client.go +++ b/httpx/client.go @@ -23,8 +23,12 @@ func NewClient() *http.Client { } } -func NewTransport() *http.Transport { - transport := http.DefaultTransport.(*http.Transport).Clone() +func NewTransport() http.RoundTripper { + t, ok := http.DefaultTransport.(*http.Transport) + if !ok { + return http.DefaultTransport + } + transport := t.Clone() transport.DialContext = (&net.Dialer{ Timeout: 20 * time.Second, }).DialContext