Skip to content

Commit

Permalink
Add http response close in client post function
Browse files Browse the repository at this point in the history
  • Loading branch information
chienfuchen32 committed Feb 16, 2021
1 parent 6eb1640 commit 152fb8b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions api/client/client.go
Expand Up @@ -157,6 +157,7 @@ func (srv *server) post(url string, jsonData []byte) (*api.Response, error) {
return nil, errors.Wrap(errors.APIClientError, errors.ClientHTTPError, err)
}
defer req.Body.Close()
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, errors.Wrap(errors.APIClientError, errors.IOError, err)
Expand Down

0 comments on commit 152fb8b

Please sign in to comment.