diff --git a/api/api.go b/api/api.go index 6f90ed5d6..1c9f1e2b7 100644 --- a/api/api.go +++ b/api/api.go @@ -7,6 +7,7 @@ import ( "encoding/json" "fmt" "io" + "io/ioutil" "log" "net" "net/http" @@ -648,6 +649,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 }