fix: use DefaultTransport in exchangeWithClientSecret if nil (#10551)

This commit is contained in:
Kyle Carberry
2023-11-06 10:55:00 -06:00
committed by GitHub
parent ca6e6213bf
commit 7162dc7e14

View File

@ -635,6 +635,9 @@ func (e *exchangeWithClientSecret) Exchange(ctx context.Context, code string, op
httpClient = http.DefaultClient
}
oldTransport := httpClient.Transport
if oldTransport == nil {
oldTransport = http.DefaultTransport
}
httpClient.Transport = roundTripper(func(req *http.Request) (*http.Response, error) {
req.Header.Set("Authorization", "Bearer "+e.ClientSecret)
return oldTransport.RoundTrip(req)