Skip to content

Commit

Permalink
Merge pull request #1 from RycCheen/master
Browse files Browse the repository at this point in the history
add resp.Body.Close() to release response body resource
  • Loading branch information
CatchZeng authored May 12, 2020
2 parents 69c914d + 3940133 commit c10a8a5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (d *DingTalk) Send(message message.Message) (Response, error) {
return res, err
}

req, err := http.NewRequest("POST", pushURL, bytes.NewReader(reqBytes))
req, err := http.NewRequest(http.MethodPost, pushURL, bytes.NewReader(reqBytes))
if err != nil {
return res, err
}
Expand All @@ -53,6 +53,7 @@ func (d *DingTalk) Send(message message.Message) (Response, error) {
if err != nil {
return res, err
}
defer resp.Body.Close()

resultByte, err := ioutil.ReadAll(resp.Body)
if err != nil {
Expand Down

0 comments on commit c10a8a5

Please sign in to comment.