From 56530a8a66937194fb4e99af95bcea6bb0281f66 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Wed, 18 May 2022 10:59:07 -0600 Subject: Implement asset deletion and fix redirect logic --- srv/src/api/apiutil/apiutil.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'srv/src/api/apiutil/apiutil.go') diff --git a/srv/src/api/apiutil/apiutil.go b/srv/src/api/apiutil/apiutil.go index f7830ae..d427b65 100644 --- a/srv/src/api/apiutil/apiutil.go +++ b/srv/src/api/apiutil/apiutil.go @@ -121,7 +121,13 @@ func MethodMux(handlers map[string]http.Handler) http.Handler { return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { - handler, ok := handlers[strings.ToUpper(r.Method)] + method := strings.ToUpper(r.FormValue("method")) + + if method == "" { + method = strings.ToUpper(r.Method) + } + + handler, ok := handlers[method] if !ok { http.Error(rw, "Method not allowed", http.StatusMethodNotAllowed) -- cgit v1.2.3