summaryrefslogtreecommitdiff
path: root/srv/src/http/apiutil
diff options
context:
space:
mode:
authorBrian Picciano <mediocregopher@gmail.com>2022-05-20 19:29:01 -0600
committerBrian Picciano <mediocregopher@gmail.com>2022-05-20 19:29:01 -0600
commit034342421bd0b3d40276df79a0f2450d1fbd643f (patch)
tree4f2c9fd5a783135914d9b9a4a04d97b7c2512d45 /srv/src/http/apiutil
parent1181af0318059e41d5564e6ef786122c7ee4c8e1 (diff)
Simplify routes by moving formMiddleware to the global level
Diffstat (limited to 'srv/src/http/apiutil')
-rw-r--r--srv/src/http/apiutil/apiutil.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/srv/src/http/apiutil/apiutil.go b/srv/src/http/apiutil/apiutil.go
index d427b65..aa62299 100644
--- a/srv/src/http/apiutil/apiutil.go
+++ b/srv/src/http/apiutil/apiutil.go
@@ -121,10 +121,11 @@ func MethodMux(handlers map[string]http.Handler) http.Handler {
return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
- method := strings.ToUpper(r.FormValue("method"))
+ method := strings.ToUpper(r.Method)
+ formMethod := strings.ToUpper(r.FormValue("method"))
- if method == "" {
- method = strings.ToUpper(r.Method)
+ if method == "POST" && formMethod != "" {
+ method = formMethod
}
handler, ok := handlers[method]