From c17d949c7001b7907c2a643771e673c2af317a60 Mon Sep 17 00:00:00 2001 From: Nghia Tran Date: Fri, 1 Mar 2024 10:17:49 -0800 Subject: [PATCH] Avoid modifying the DefaultClient's Transport Signed-off-by: Nghia Tran --- v2/protocol/http/protocol.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/v2/protocol/http/protocol.go b/v2/protocol/http/protocol.go index dba6fd7ba..5a307dbca 100644 --- a/v2/protocol/http/protocol.go +++ b/v2/protocol/http/protocol.go @@ -102,7 +102,10 @@ func New(opts ...Option) (*Protocol, error) { } if p.Client == nil { - p.Client = http.DefaultClient + // This is how http.DefaultClient is initialized. We do not just use + // that because when WithTransport is used, it will change the client's + // transport, which would cause that transport to be used process-wide. + p.Client = &http.Client{} } if p.roundTripper != nil {