Close HTTP response bodies properly in golang driver (and some api functions) (#3217)

Этот коммит содержится в:
Joram Wilander
2016-06-02 15:40:34 -04:00
коммит произвёл Corey Hulen
родитель 848a8663ed
Коммит 0788e83647
3 изменённых файлов: 120 добавлений и 4 удалений

Просмотреть файл

@@ -203,6 +203,7 @@ func executeCommand(c *Context, w http.ResponseWriter, r *http.Request) {
handleResponse(c, w, response, channelId, cmd, false)
}
} else {
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
c.Err = model.NewLocAppError("command", "api.command.execute_command.failed_resp.app_error", map[string]interface{}{"Trigger": trigger, "Status": resp.Status}, string(body))
}