func (c *ContentController) handleFilePOST(path string, e *httpapp.Env) *httpapp.Response { f, err := model.CreateVersionedFileModel(path, util.SlurpRequestBody(e)) if err != nil { panic(err) } c.commitChanges(f, e) resp := httpapp.NewResponse(http.StatusNoContent) resp.Headers.Add("Location", e.Request.URL.Path) resp.Headers.Add("Content-Type", util.GuessMediaType(f.Name())) return resp }
func (c *ContentController) handleFilePUT(f *model.VersionedFile, e *httpapp.Env) *httpapp.Response { f.Write(util.SlurpRequestBody(e)) c.commitChanges(f, e) return httpapp.NewResponse(http.StatusNoContent) }