diff --git a/client.go b/client.go index 754330f..958fb0c 100644 --- a/client.go +++ b/client.go @@ -261,7 +261,12 @@ func (c *Client) ReadStream(path string) (io.ReadCloser, error) { if err != nil { return nil, newPathErrorErr("ReadStream", path, err) } - return rs.Body, nil + if rs.StatusCode == 200 { + return rs.Body, nil + } else { + rs.Body.Close() + return nil, newPathError("ReadStream", path, rs.StatusCode) + } } func (c *Client) Write(path string, data []byte, _ os.FileMode) error {