in GoBlog/main.go [126:141]
func ChangeMethod(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.Method == http.MethodPost {
switch method := r.PostFormValue("_method"); method {
case http.MethodPut:
fallthrough
case http.MethodPatch:
fallthrough
case http.MethodDelete:
r.Method = method
default:
}
}
next.ServeHTTP(w, r)
})
}