diff options
author | Brian Picciano <mediocregopher@gmail.com> | 2022-11-29 20:59:31 +0100 |
---|---|---|
committer | Brian Picciano <mediocregopher@gmail.com> | 2022-11-29 20:59:31 +0100 |
commit | 1f3ae665ed2e58ca572678ce7caf8b711f226392 (patch) | |
tree | e023602e07e2a80d24ef9d9527ddca0e1640e929 /src/http/apiutil | |
parent | 31f8f37c5ad3ad4ac7b3cc93d0257dd80c877c7c (diff) |
Introduce EDIT and MANAGE methods
All admin "index" pages are moved under MANAGE, so that we can have (for
example) and normal "GET /posts" page later which would replace the
current index page, and potentially corresponding pages for the other
categories.
The EDIT method replaces the old `?edit` pattern, which normalizes how
we differentiate page functionality generally.
Diffstat (limited to 'src/http/apiutil')
-rw-r--r-- | src/http/apiutil/apiutil.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/http/apiutil/apiutil.go b/src/http/apiutil/apiutil.go index fed6fb5..1fbadea 100644 --- a/src/http/apiutil/apiutil.go +++ b/src/http/apiutil/apiutil.go @@ -120,6 +120,9 @@ func RandStr(numBytes int) string { // // If the method "*" is defined then all methods not defined will be directed to // that handler, and 405 Method Not Allowed is never returned. +// +// If the GET argument 'method' is present then the ToUpper of that is taken to +// be the name of the method. func MethodMux(handlers map[string]http.Handler) http.Handler { return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { @@ -127,7 +130,7 @@ func MethodMux(handlers map[string]http.Handler) http.Handler { method := strings.ToUpper(r.Method) formMethod := strings.ToUpper(r.FormValue("method")) - if method == "POST" && formMethod != "" { + if formMethod != "" { method = formMethod } |