Fix stepdown body closing

This commit is contained in:
Jeff Mitchell 2018-08-04 11:50:29 -04:00
parent 45341f911c
commit 463455aa03

View File

@ -8,8 +8,8 @@ func (c *Sys) StepDown() error {
ctx, cancelFunc := context.WithCancel(context.Background())
defer cancelFunc()
resp, err := c.c.RawRequestWithContext(ctx, r)
if err == nil {
defer resp.Body.Close()
if resp != nil && resp.Body != nil {
resp.Body.Close()
}
return err
}