From 7d006ba4edaffef687b9020d7ac62362fb40973a Mon Sep 17 00:00:00 2001 From: Jared Wasinger Date: Thu, 25 May 2017 20:51:27 -0700 Subject: [PATCH] Prevent Session.Destroy from leaving open TCP connections --- api/api.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api/api.go b/api/api.go index 2225dd3bf..87227c38a 100644 --- a/api/api.go +++ b/api/api.go @@ -7,6 +7,7 @@ import ( "encoding/json" "fmt" "io" + "io/ioutil" "log" "net" "net/http" @@ -649,6 +650,8 @@ func (c *Client) write(endpoint string, in, out interface{}, q *WriteOptions) (* if err := decodeBody(resp, &out); err != nil { return nil, err } + } else if _, err := ioutil.ReadAll(resp.Body); err != nil { + return nil, err } return wm, nil }