don't export requests
This commit is contained in:
parent
c1fc968bc9
commit
544a4735b6
@ -32,7 +32,7 @@ func NewClient(uri string, user string, pw string) *Client {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) Connect() error {
|
func (c *Client) Connect() error {
|
||||||
if rs, err := c.Options("/"); err == nil {
|
if rs, err := c.options("/"); err == nil {
|
||||||
defer rs.Body.Close()
|
defer rs.Body.Close()
|
||||||
|
|
||||||
if rs.StatusCode != 200 || (rs.Header.Get("Dav") == "" && rs.Header.Get("DAV") == "") {
|
if rs.StatusCode != 200 || (rs.Header.Get("Dav") == "" && rs.Header.Get("DAV") == "") {
|
||||||
@ -103,7 +103,7 @@ func (c *Client) ReadDir(path string) ([]os.FileInfo, error) {
|
|||||||
r.Props = nil
|
r.Props = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
err := c.Propfind(path, false,
|
err := c.propfind(path, false,
|
||||||
`<d:propfind xmlns:d='DAV:'>
|
`<d:propfind xmlns:d='DAV:'>
|
||||||
<d:prop>
|
<d:prop>
|
||||||
<d:displayname/>
|
<d:displayname/>
|
||||||
@ -133,7 +133,7 @@ func (c *Client) Remove(path string) error {
|
|||||||
|
|
||||||
func (c *Client) Mkdir(path string) error {
|
func (c *Client) Mkdir(path string) error {
|
||||||
path = FixSlashes(path)
|
path = FixSlashes(path)
|
||||||
status := c.MkCol(path)
|
status := c.mkcol(path)
|
||||||
if status == 201 {
|
if status == 201 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ func (c *Client) reqDo(method string, path string, body io.Reader) (*http.Respon
|
|||||||
return c.c.Do(rq)
|
return c.c.Do(rq)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) MkCol(path string) int {
|
func (c *Client) mkcol(path string) int {
|
||||||
rs, err := c.reqDo("MKCOL", path, nil)
|
rs, err := c.reqDo("MKCOL", path, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 400
|
return 400
|
||||||
@ -44,7 +44,7 @@ func (c *Client) MkCol(path string) int {
|
|||||||
return rs.StatusCode
|
return rs.StatusCode
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) Options(path string) (*http.Response, error) {
|
func (c *Client) options(path string) (*http.Response, error) {
|
||||||
rq, err := c.req("OPTIONS", path, nil)
|
rq, err := c.req("OPTIONS", path, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -55,7 +55,7 @@ func (c *Client) Options(path string) (*http.Response, error) {
|
|||||||
return c.c.Do(rq)
|
return c.c.Do(rq)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) Propfind(path string, self bool, body string, resp interface{}, parse func(resp interface{})) error {
|
func (c *Client) propfind(path string, self bool, body string, resp interface{}, parse func(resp interface{})) error {
|
||||||
rq, err := c.req("PROPFIND", path, strings.NewReader(body))
|
rq, err := c.req("PROPFIND", path, strings.NewReader(body))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user