diff --git a/client.go b/client.go index a655933a..3435fb85 100644 --- a/client.go +++ b/client.go @@ -168,10 +168,12 @@ func (c *APIClient) Patch(url string, payload interface{}) (*http.Response, erro // Delete performs a Delete request against the Redfish service. func (c *APIClient) Delete(url string) error { resp, err := c.runRequest("DELETE", url, nil) - resp.Body.Close() if err != nil { return err } + if resp != nil && resp.Body != nil { + resp.Body.Close() + } return nil }