summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-05-23 07:02:28 -0400
committerGitHub <noreply@github.com>2020-05-23 07:02:28 -0400
commit56a95b0e7d1a9268873cf74e7746c3da48881f35 (patch)
tree9ef386ace1edad009316663db3db3e84169d2c12
parente323d3e92d618f76efe63a29ae53150c943e1fbe (diff)
parent6f5bc712ded2754b6bb86f55961478f3fb24bc8f (diff)
downloadpodman-56a95b0e7d1a9268873cf74e7746c3da48881f35.tar.gz
podman-56a95b0e7d1a9268873cf74e7746c3da48881f35.tar.bz2
podman-56a95b0e7d1a9268873cf74e7746c3da48881f35.zip
Merge pull request #6355 from jwhonce/wip/MethodNotAllowedHandler
Add MethodNotAllowedHandler() to add in debugging
-rw-r--r--pkg/api/server/server.go8
1 files changed, 8 insertions, 0 deletions
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,