add defered closer calls for the http clients (#705)

This commit is contained in:
Simon Aronsson 2020-12-09 16:18:07 +01:00 committed by GitHub
parent 0f065399b0
commit ea16683c46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -91,6 +91,8 @@ func GetDigest(url string, token string) (string, error) {
if err != nil {
return "", err
}
defer res.Body.Close()
if res.StatusCode != 200 {
return "", fmt.Errorf("registry responded to head request with %d", res.StatusCode)
}