Skip to content

Commit

Permalink
Fix missing body.Close() in bearer auth (#1482)
Browse files Browse the repository at this point in the history
Signed-off-by: Spike Curtis <spike@coder.com>

Signed-off-by: Spike Curtis <spike@coder.com>
  • Loading branch information
spikecurtis committed Oct 30, 2022
1 parent 426de7d commit 1711cef
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/v1/remote/transport/bearer.go
Expand Up @@ -87,6 +87,9 @@ func (bt *bearerTransport) RoundTrip(in *http.Request) (*http.Response, error) {

// If we hit a WWW-Authenticate challenge, it might be due to expired tokens or insufficient scope.
if challenges := authchallenge.ResponseChallenges(res); len(challenges) != 0 {
// close out old response, since we will not return it.
res.Body.Close()

newScopes := []string{}
for _, wac := range challenges {
// TODO(jonjohnsonjr): Should we also update "realm" or "service"?
Expand Down

0 comments on commit 1711cef

Please sign in to comment.