From d2ef61d079000b0699a295099c35f87abb075e82 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 2225dd3bf3..87227c38aa 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 }