diff --git a/README.md b/README.md index 9c7736f..265fcb7 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ go get -u github.com/studio-b12/gowebdav/cmd/gowebdav ## Usage ```sh -$ ./gowebdav +$ gowebdav Usage: gowebdav FLAGS ARGS Flags: -X string diff --git a/client.go b/client.go index 30f3c4f..7a7f53a 100644 --- a/client.go +++ b/client.go @@ -1,3 +1,4 @@ +// Package gowebdav A golang WebDAV library package gowebdav import ( @@ -35,7 +36,7 @@ func NewClient(uri string, user string, pw string) *Client { return c } -// SetHeaders lets us set arbitrary headers for a given client +// SetHeader lets us set arbitrary headers for a given client func (c *Client) SetHeader(key, value string) { c.headers.Add(key, value) } @@ -308,12 +309,13 @@ func (c *Client) ReadStream(path string) (io.ReadCloser, error) { if err != nil { return nil, newPathErrorErr("ReadStream", path, err) } + if rs.StatusCode == 200 { return rs.Body, nil - } else { - rs.Body.Close() - return nil, newPathError("ReadStream", path, rs.StatusCode) } + + rs.Body.Close() + return nil, newPathError("ReadStream", path, rs.StatusCode) } // Write writes data to a given path diff --git a/utils.go b/utils.go index 2b558b1..43b3725 100644 --- a/utils.go +++ b/utils.go @@ -55,7 +55,7 @@ func Join(path0 string, path1 string) string { // String pulls a string out of our io.Reader func String(r io.Reader) string { buf := new(bytes.Buffer) - // TODO - mkae String return an error as well + // TODO - make String return an error as well _, _ = buf.ReadFrom(r) return buf.String() }