before and after save hooks

This commit is contained in:
Henrique Dias
2016-12-18 12:34:31 +00:00
parent 205f9a22b6
commit aae318028b
3 changed files with 83 additions and 1 deletions

View File

@@ -83,12 +83,20 @@ func (f FileManager) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, err
// Preprocess the PUT request if it's the case
if r.Method == http.MethodPut {
if err = c.BeforeSave(r, c, user); err != nil {
return http.StatusInternalServerError, err
}
if handlers.PreProccessPUT(w, r, c, user) != nil {
return http.StatusInternalServerError, err
}
}
c.Handler.ServeHTTP(w, r)
if err = c.AfterSave(r, c, user); err != nil {
return http.StatusInternalServerError, err
}
return 0, nil
}