This commit is contained in:
Christoph Polcin 2018-05-16 12:35:57 +02:00
parent 5a1a85f622
commit 732590873e
3 changed files with 8 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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()
}