mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-13 21:56:38 +01:00
add defered closer calls for the http clients (#705)
This commit is contained in:
parent
0f065399b0
commit
ea16683c46
2 changed files with 3 additions and 1 deletions
|
|
@ -37,7 +37,7 @@ func GetToken(container types.Container, registryAuth string) (string, error) {
|
||||||
if res, err = client.Do(req); err != nil {
|
if res, err = client.Do(req); err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
defer res.Body.Close()
|
||||||
v := res.Header.Get(ChallengeHeader)
|
v := res.Header.Get(ChallengeHeader)
|
||||||
|
|
||||||
logrus.WithFields(logrus.Fields{
|
logrus.WithFields(logrus.Fields{
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,8 @@ func GetDigest(url string, token string) (string, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
defer res.Body.Close()
|
||||||
|
|
||||||
if res.StatusCode != 200 {
|
if res.StatusCode != 200 {
|
||||||
return "", fmt.Errorf("registry responded to head request with %d", res.StatusCode)
|
return "", fmt.Errorf("registry responded to head request with %d", res.StatusCode)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue