Skip to content

Commit a1ddb0c

Browse files
author
Katrina Owen
authored
Merge pull request #852 from bcmmbaga/close-respBody
Ensure closing response body
2 parents ec332fb + 7ed7afe commit a1ddb0c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

api/client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ func (c *Client) TokenIsValid() (bool, error) {
8585
if err != nil {
8686
return false, err
8787
}
88+
defer resp.Body.Close()
89+
8890
return resp.StatusCode == http.StatusOK, nil
8991
}
9092

@@ -99,6 +101,8 @@ func (c *Client) IsPingable() error {
99101
if err != nil {
100102
return err
101103
}
104+
defer resp.Body.Close()
105+
102106
if resp.StatusCode != http.StatusOK {
103107
return fmt.Errorf("API returned %s", resp.Status)
104108
}

0 commit comments

Comments
 (0)