mirror of
https://github.com/coder/coder.git
synced 2025-07-09 11:45:56 +00:00
fix: use DefaultTransport
in exchangeWithClientSecret
if nil (#10551)
This commit is contained in:
@ -635,6 +635,9 @@ func (e *exchangeWithClientSecret) Exchange(ctx context.Context, code string, op
|
|||||||
httpClient = http.DefaultClient
|
httpClient = http.DefaultClient
|
||||||
}
|
}
|
||||||
oldTransport := httpClient.Transport
|
oldTransport := httpClient.Transport
|
||||||
|
if oldTransport == nil {
|
||||||
|
oldTransport = http.DefaultTransport
|
||||||
|
}
|
||||||
httpClient.Transport = roundTripper(func(req *http.Request) (*http.Response, error) {
|
httpClient.Transport = roundTripper(func(req *http.Request) (*http.Response, error) {
|
||||||
req.Header.Set("Authorization", "Bearer "+e.ClientSecret)
|
req.Header.Set("Authorization", "Bearer "+e.ClientSecret)
|
||||||
return oldTransport.RoundTrip(req)
|
return oldTransport.RoundTrip(req)
|
||||||
|
Reference in New Issue
Block a user