From 16e7651fdfbc46c6cc879fca2c3e343855fc4eb0 Mon Sep 17 00:00:00 2001 From: Roger Peppe Date: Mon, 18 Mar 2024 16:54:19 +0000 Subject: [PATCH] ociregistry/ociauth: pass context to token GET requests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Change-Id: I7084253af14dd9b57e92aea86bc161d6a3aceb49 Reviewed-on: https://review.gerrithub.io/c/cue-labs/oci/+/1184461 Reviewed-by: Daniel Martí TryBot-Result: CUE porcuepine --- ociregistry/ociauth/auth.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ociregistry/ociauth/auth.go b/ociregistry/ociauth/auth.go index 5caf5b6..70f00ba 100644 --- a/ociregistry/ociauth/auth.go +++ b/ociregistry/ociauth/auth.go @@ -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 }