feat(smalltrip,middleware): FormMethod middleware

This commit is contained in:
Guz
2025-08-08 19:17:57 -03:00
parent 40a6ff1e45
commit 86e40f2707

View File

@@ -0,0 +1,17 @@
package middleware
import (
"net/http"
"strings"
)
func FormMethod(key string) Middleware {
return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if v := r.FormValue(key); v != "" {
r.Method = strings.ToUpper(v)
}
next.ServeHTTP(w, r)
})
}
}