mirror of
https://github.com/gomods/athens
synced 2026-02-03 11:00:32 +00:00
* Upgrade buffalo * Switch to go modules everywhere * Fixes from buffalo fix * Add missing modules from module list * Update vendored modules in /vendor * Stop using vendor directory for tests * Check go.mod and go.sum files on verify * Upgrade Buffalo from v0.13.0 to v0.13.1 * Fix test for new Buffalo Allow for new Buffalo code * Add test for endpoint with trailing slash
22 lines
643 B
Go
22 lines
643 B
Go
package buffalo
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gobuffalo/x/defaults"
|
|
)
|
|
|
|
// MethodOverride is the default implementation for the
|
|
// Options#MethodOverride. By default it will look for a form value
|
|
// name `_method` and change the request method if that is
|
|
// present and the original request is of type "POST". This is
|
|
// added automatically when using `New` Buffalo, unless
|
|
// an alternative is defined in the Options.
|
|
func MethodOverride(res http.ResponseWriter, req *http.Request) {
|
|
if req.Method == "POST" {
|
|
req.Method = defaults.String(req.FormValue("_method"), "POST")
|
|
req.Form.Del("_method")
|
|
req.PostForm.Del("_method")
|
|
}
|
|
}
|