diff options
author | Christopher Speller <crspeller@gmail.com> | 2017-01-24 20:02:41 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-24 20:02:41 -0500 |
commit | 27f76afb288b7c24f5ce1d0274ed3ae73c77e076 (patch) | |
tree | 4590b87b55ba97752a6760c18be90c2bda582de2 /api/api.go | |
parent | 3234f98aec24c4f0f04fa6d083678afbf793b9d2 (diff) | |
download | chat-27f76afb288b7c24f5ce1d0274ed3ae73c77e076.tar.gz chat-27f76afb288b7c24f5ce1d0274ed3ae73c77e076.tar.bz2 chat-27f76afb288b7c24f5ce1d0274ed3ae73c77e076.zip |
Closing response body when fetching link previews (#5181)
Diffstat (limited to 'api/api.go')
-rw-r--r-- | api/api.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/api/api.go b/api/api.go index 59c547b8c..3d2217ef5 100644 --- a/api/api.go +++ b/api/api.go @@ -4,6 +4,7 @@ package api import ( + "io/ioutil" "net/http" "github.com/gorilla/mux" @@ -143,3 +144,10 @@ func ReturnStatusOK(w http.ResponseWriter) { m[model.STATUS] = model.STATUS_OK w.Write([]byte(model.MapToJson(m))) } + +func closeBody(r *http.Response) { + if r.Body != nil { + ioutil.ReadAll(r.Body) + r.Body.Close() + } +} |