Skip to content

Commit

Permalink
golang#368 NewClient copies all settings from the context client
Browse files Browse the repository at this point in the history
  • Loading branch information
Ferdy Pruis committed Oct 1, 2021
1 parent d2ed32b commit a1a5bef
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion oauth2.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,11 +343,16 @@ func NewClient(ctx context.Context, src TokenSource) *http.Client {
if src == nil {
return internal.ContextClient(ctx)
}

cc := internal.ContextClient(ctx)
return &http.Client{
Transport: &Transport{
Base: internal.ContextClient(ctx).Transport,
Base: cc.Transport,
Source: ReuseTokenSource(nil, src),
},
CheckRedirect: cc.CheckRedirect,
Jar: cc.Jar,
Timeout: cc.Timeout,
}
}

Expand Down

0 comments on commit a1a5bef

Please sign in to comment.