From 6f5bc712ded2754b6bb86f55961478f3fb24bc8f Mon Sep 17 00:00:00 2001 From: Jhon Honce Date: Fri, 22 May 2020 11:38:05 -0700 Subject: Add MethodNotAllowedHandler() to add in debugging Signed-off-by: Jhon Honce --- pkg/api/server/server.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/api/server/server.go b/pkg/api/server/server.go index d39528f45..9cbc66e87 100644 --- a/pkg/api/server/server.go +++ b/pkg/api/server/server.go @@ -92,6 +92,14 @@ func newServer(runtime *libpod.Runtime, duration time.Duration, listener *net.Li }, ) + router.MethodNotAllowedHandler = http.HandlerFunc( + func(w http.ResponseWriter, r *http.Request) { + // We can track user errors... + logrus.Infof("Failed Request: (%d:%s) for %s:'%s'", http.StatusMethodNotAllowed, http.StatusText(http.StatusMethodNotAllowed), r.Method, r.URL.String()) + http.Error(w, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed) + }, + ) + for _, fn := range []func(*mux.Router) error{ server.registerAuthHandlers, server.registerContainersHandlers, -- cgit v1.2.3-54-g00ecf