Merge pull request #3077 from jwasinger/issue-2850

Prevent Session.Destroy from leaving open TCP connections
This commit is contained in:
James Phillips 2017-06-02 21:43:55 -07:00 committed by GitHub
commit 6239c4aa50
1 changed files with 3 additions and 0 deletions

View File

@ -7,6 +7,7 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"io" "io"
"io/ioutil"
"log" "log"
"net" "net"
"net/http" "net/http"
@ -648,6 +649,8 @@ func (c *Client) write(endpoint string, in, out interface{}, q *WriteOptions) (*
if err := decodeBody(resp, &out); err != nil { if err := decodeBody(resp, &out); err != nil {
return nil, err return nil, err
} }
} else if _, err := ioutil.ReadAll(resp.Body); err != nil {
return nil, err
} }
return wm, nil return wm, nil
} }