forked from remote/oauth2
internal: Use provided context in subsequent request
Currently the HTTP request does not set the given context. This change sets the context (if not nil) on the request. Change-Id: I4bb21636d05050a68ba70ce92f9bf9ba608fbfad Reviewed-on: https://go-review.googlesource.com/45370 Run-TryBot: Chris Broadfoot <cbro@golang.org> Reviewed-by: Jaana Burcu Dogan <jbd@google.com> Reviewed-by: Chris Broadfoot <cbro@golang.org>
This commit is contained in:
committed by
Chris Broadfoot
parent
5432cc9688
commit
626d87b993
@@ -18,6 +18,7 @@ import (
|
||||
"time"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
"golang.org/x/net/context/ctxhttp"
|
||||
)
|
||||
|
||||
// Token represents the crendentials used to authorize
|
||||
@@ -189,7 +190,7 @@ func RetrieveToken(ctx context.Context, clientID, clientSecret, tokenURL string,
|
||||
if !bustedAuth {
|
||||
req.SetBasicAuth(clientID, clientSecret)
|
||||
}
|
||||
r, err := hc.Do(req)
|
||||
r, err := ctxhttp.Do(ctx, hc, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user