Finish the prop set feature.

This commit is contained in:
zicla
2020-03-26 02:19:43 +08:00
parent 1f047e25c7
commit 4bfae38176
5 changed files with 81 additions and 9 deletions

View File

@ -593,7 +593,7 @@ func (h *Handler) handleProppatch(w http.ResponseWriter, r *http.Request) (statu
}
return http.StatusMethodNotAllowed, err
}
patches, status, err := readProppatch(r.Body)
patches, status, err := ReadProppatch(r.Body)
if err != nil {
return status, err
}

View File

@ -493,7 +493,7 @@ type propertyupdate struct {
SetRemove []setRemove `xml:",any"`
}
func readProppatch(r io.Reader) (patches []Proppatch, status int, err error) {
func ReadProppatch(r io.Reader) (patches []Proppatch, status int, err error) {
var pu propertyupdate
if err = ixml.NewDecoder(r).Decode(&pu); err != nil {
return nil, http.StatusBadRequest, err

View File

@ -705,7 +705,7 @@ func TestReadProppatch(t *testing.T) {
}}
for _, tc := range testCases {
pp, status, err := readProppatch(strings.NewReader(tc.input))
pp, status, err := ReadProppatch(strings.NewReader(tc.input))
if tc.wantStatus != 0 {
if err == nil {
t.Errorf("%s: got nil error, want non-nil", tc.desc)