webdav: add MKCOL support to server

This commit is contained in:
Simon Ser
2020-01-21 22:05:59 +01:00
parent a2ad695145
commit e9e1f102de
4 changed files with 36 additions and 1 deletions

View File

@@ -79,6 +79,7 @@ type Backend interface {
Propfind(r *http.Request, pf *Propfind, depth Depth) (*Multistatus, error)
Put(r *http.Request) error
Delete(r *http.Request) error
Mkcol(r *http.Request) error
}
type Handler struct {
@@ -111,6 +112,11 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
case "PROPFIND":
err = h.handlePropfind(w, r)
case "MKCOL":
err = h.Backend.Mkcol(r)
if err == nil {
w.WriteHeader(http.StatusCreated)
}
default:
err = HTTPErrorf(http.StatusMethodNotAllowed, "webdav: unsupported method")
}