Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f60c73fbb4 | ||
|
|
a11466bd13 | ||
|
|
e3cd1f98e7 | ||
|
|
e3a31466a7 | ||
|
|
2b5dab74d3 | ||
|
|
79a29f3ad5 | ||
|
|
a03a0a3645 | ||
|
|
12fe295146 |
15
client.go
15
client.go
@@ -33,6 +33,14 @@ func NewClient(uri string, user string, pw string) *Client {
|
||||
return c
|
||||
}
|
||||
|
||||
func (c *Client) SetHeader(key, value string) {
|
||||
c.headers.Add(key, value)
|
||||
}
|
||||
|
||||
func (c *Client) SetTransport(transport http.RoundTripper) {
|
||||
c.c.Transport = transport
|
||||
}
|
||||
|
||||
func (c *Client) Connect() error {
|
||||
rs, err := c.options("/")
|
||||
if err == nil {
|
||||
@@ -188,7 +196,7 @@ func (c *Client) RemoveAll(path string) error {
|
||||
}
|
||||
rs.Body.Close()
|
||||
|
||||
if rs.StatusCode == 200 || rs.StatusCode == 404 {
|
||||
if rs.StatusCode == 200 || rs.StatusCode == 204 || rs.StatusCode == 404 {
|
||||
return nil
|
||||
} else {
|
||||
return newPathError("Remove", path, rs.StatusCode)
|
||||
@@ -253,7 +261,12 @@ 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)
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client) Write(path string, data []byte, _ os.FileMode) error {
|
||||
|
||||
Reference in New Issue
Block a user