Skip to content

Commit

Permalink
ociregistry/ociauth: pass context to token GET requests
Browse files Browse the repository at this point in the history
Although POST requests to the token server were correctly
being passed the context, GET requests were not.

Remedy that by using `NewRequestWithContext` instead
of `NewRequest`.

Signed-off-by: Roger Peppe <rogpeppe@gmail.com>
Change-Id: I7084253af14dd9b57e92aea86bc161d6a3aceb49
Reviewed-on: https://review.gerrithub.io/c/cue-labs/oci/+/1184461
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: CUE porcuepine <cue.porcuepine@gmail.com>
  • Loading branch information
rogpeppe committed Mar 19, 2024
1 parent 39d12ee commit 16e7651
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ociregistry/ociauth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ func (r *registry) acquireToken(ctx context.Context, scope Scope) (*wireToken, e
v.Set("service", service)
}
u.RawQuery = v.Encode()
req, err := http.NewRequest("GET", u.String(), nil)
req, err := http.NewRequestWithContext(ctx, "GET", u.String(), nil)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 16e7651

Please sign in to comment.