Close response body properly (#143)

This commit is contained in:
Dejan Mijić 2018-01-13 18:15:41 +01:00 committed by GitHub
parent 4f467dcdde
commit 7cc03be424
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

@ -68,11 +68,10 @@ func (mc ManagerClient) makeRequest(url, token string) (string, error) {
mgReq.Header.Set("Authorization", token)
res, err := hc.Do(mgReq)
defer res.Body.Close()
if err != nil {
return "", ErrServiceUnreachable
}
defer res.Body.Close()
if res.StatusCode != http.StatusOK {
return manager.ErrUnauthorizedAccess, nil