internal: add helpers to parse multistatus

This commit is contained in:
Simon Ser
2020-01-14 21:29:54 +01:00
parent 93f95c7fd2
commit 5748fec4d0
4 changed files with 99 additions and 33 deletions

View File

@@ -64,7 +64,7 @@ func (c *Client) Do(req *http.Request) (*http.Response, error) {
return c.http.Do(req)
}
func (c *Client) DoMultiStatus(req *http.Request) ([]Response, error) {
func (c *Client) DoMultiStatus(req *http.Request) (*Multistatus, error) {
resp, err := c.Do(req)
if err != nil {
return nil, err
@@ -76,10 +76,10 @@ func (c *Client) DoMultiStatus(req *http.Request) ([]Response, error) {
}
// TODO: the response can be quite large, support streaming Response elements
var ms multistatus
var ms Multistatus
if err := xml.NewDecoder(resp.Body).Decode(&ms); err != nil {
return nil, err
}
return ms.Responses, nil
return &ms, nil
}