Skip to content

Commit

Permalink
Avoid modifying the DefaultClient's Transport
Browse files Browse the repository at this point in the history
Signed-off-by: Nghia Tran <tcnghia@gmail.com>
  • Loading branch information
tcnghia committed Mar 1, 2024
1 parent 67e3899 commit c17d949
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion v2/protocol/http/protocol.go
Expand Up @@ -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 {
Expand Down

0 comments on commit c17d949

Please sign in to comment.