Skip to content

Commit

Permalink
Set transport to be http.Default transport
Browse files Browse the repository at this point in the history
This sets the transport to be http.DefaultTransport, so that any
decorators can rely on the transport being there.
  • Loading branch information
alistairjudson committed Feb 6, 2020
1 parent ace462d commit 3603a19
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions httpclient/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ type Params struct {

// New creates a new instance of an *http.Client
func New(params Params) *http.Client {
client := http.DefaultClient
transport := http.DefaultTransport
for _, tripper := range params.Trippers {
client.Transport = tripper(client.Transport)
transport = tripper(transport)
}
client := http.DefaultClient
client.Transport = transport
return client
}

0 comments on commit 3603a19

Please sign in to comment.