Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1711cef

Browse files
authoredOct 30, 2022
Fix missing body.Close() in bearer auth (#1482)
Signed-off-by: Spike Curtis <spike@coder.com> Signed-off-by: Spike Curtis <spike@coder.com>
1 parent 426de7d commit 1711cef

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed
 

‎pkg/v1/remote/transport/bearer.go

+3
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ func (bt *bearerTransport) RoundTrip(in *http.Request) (*http.Response, error) {
8787

8888
// If we hit a WWW-Authenticate challenge, it might be due to expired tokens or insufficient scope.
8989
if challenges := authchallenge.ResponseChallenges(res); len(challenges) != 0 {
90+
// close out old response, since we will not return it.
91+
res.Body.Close()
92+
9093
newScopes := []string{}
9194
for _, wac := range challenges {
9295
// TODO(jonjohnsonjr): Should we also update "realm" or "service"?

0 commit comments

Comments
 (0)
Please sign in to comment.