Merge pull request #2 from weaveworks/panicclose

Close body after error check
This commit is contained in:
Adam Harrison
2017-10-04 10:03:13 +01:00
committed by GitHub

View File

@@ -29,10 +29,10 @@ func NotifyReboot(hookURL, username, nodeID string) error {
}
resp, err := httpClient.Post(hookURL, "application/json", &buf)
defer resp.Body.Close()
if err != nil {
return err
}
defer resp.Body.Close()
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return fmt.Errorf(resp.Status)