summaryrefslogtreecommitdiff
path: root/src/http/apiutil
diff options
context:
space:
mode:
Diffstat (limited to 'src/http/apiutil')
-rw-r--r--src/http/apiutil/apiutil.go5
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
}