mirror of
https://github.com/1f349/go-webdav.git
synced 2024-12-23 00:34:23 +00:00
internal: allow Response.DecodeProp to decode multiple values
This commit is contained in:
parent
3e41eefd12
commit
63cdea07be
@ -131,7 +131,8 @@ func IsMissingProp(err error) bool {
|
|||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|
||||||
func (resp *Response) DecodeProp(v interface{}) error {
|
func (resp *Response) DecodeProp(values ...interface{}) error {
|
||||||
|
for _, v := range values {
|
||||||
// TODO wrap errors with more context (XML name)
|
// TODO wrap errors with more context (XML name)
|
||||||
name, err := valueXMLName(v)
|
name, err := valueXMLName(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -151,6 +152,9 @@ func (resp *Response) DecodeProp(v interface{}) error {
|
|||||||
return raw.Decode(v)
|
return raw.Decode(v)
|
||||||
}
|
}
|
||||||
return &missingPropError{name}
|
return &missingPropError{name}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (resp *Response) EncodeProp(code int, v interface{}) error {
|
func (resp *Response) EncodeProp(code int, v interface{}) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user