Close body after error check

Otherwise it panics for nil body
This commit is contained in:
Elena Morozova
2017-10-03 23:10:42 -07:00
parent adf8147ab6
commit d3fa3ffd40
+1 -1
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)