post
parent
de66f1a9fb
commit
1d235c9852
10
api.go
10
api.go
|
@ -79,7 +79,7 @@ func resourceHandler(c *requestContext, w http.ResponseWriter, r *http.Request)
|
|||
case http.MethodPut:
|
||||
return putHandler(c, w, r)
|
||||
case http.MethodPost:
|
||||
// Handle renaming
|
||||
return postHandler(c, w, r)
|
||||
}
|
||||
|
||||
/* // Execute beforeSave if it is a PUT request.
|
||||
|
@ -211,6 +211,14 @@ func putHandler(c *requestContext, w http.ResponseWriter, r *http.Request) (int,
|
|||
return http.StatusOK, nil
|
||||
}
|
||||
|
||||
func postHandler(c *requestContext, w http.ResponseWriter, r *http.Request) (int, error) {
|
||||
dst := r.Header.Get("Destination")
|
||||
src := r.URL.Path
|
||||
err := c.us.fileSystem.Rename(context.TODO(), src, dst)
|
||||
|
||||
return errorToHTTP(err, true), err
|
||||
}
|
||||
|
||||
// displayMode obtaisn the display mode from URL, or from the
|
||||
// cookie.
|
||||
func displayMode(w http.ResponseWriter, r *http.Request, scope string) string {
|
||||
|
|
Loading…
Reference in New Issue