From 0788e836475722123c36835489396d65c6f9b252 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Thu, 2 Jun 2016 15:40:34 -0400 Subject: Close HTTP response bodies properly in golang driver (and some api functions) (#3217) --- api/post.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'api/post.go') diff --git a/api/post.go b/api/post.go index 875f30ba5..831591784 100644 --- a/api/post.go +++ b/api/post.go @@ -8,6 +8,7 @@ import ( "fmt" "html/template" "io" + "io/ioutil" "net/http" "net/url" "path/filepath" @@ -428,6 +429,10 @@ func handleWebhookEvents(c *Context, post *model.Post, team *model.Team, channel if resp, err := client.Do(req); err != nil { l4g.Error(utils.T("api.post.handle_webhook_events_and_forget.event_post.error"), err.Error()) } else { + defer func() { + ioutil.ReadAll(resp.Body) + resp.Body.Close() + }() respProps := model.MapFromJson(resp.Body) // copy the context and create a mock session for posting the message -- cgit v1.2.3-1-g7c22