Skip to content

Commit

Permalink
Merge pull request #852 from bcmmbaga/close-respBody
Browse files Browse the repository at this point in the history
Ensure closing response body
  • Loading branch information
Katrina Owen authored Jun 26, 2019
2 parents ec332fb + 7ed7afe commit a1ddb0c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ func (c *Client) TokenIsValid() (bool, error) {
if err != nil {
return false, err
}
defer resp.Body.Close()

return resp.StatusCode == http.StatusOK, nil
}

Expand All @@ -99,6 +101,8 @@ func (c *Client) IsPingable() error {
if err != nil {
return err
}
defer resp.Body.Close()

if resp.StatusCode != http.StatusOK {
return fmt.Errorf("API returned %s", resp.Status)
}
Expand Down

0 comments on commit a1ddb0c

Please sign in to comment.