Skip to content

Commit

Permalink
Add MethodNotAllowedHandler() to add in debugging
Browse files Browse the repository at this point in the history
Signed-off-by: Jhon Honce <jhonce@redhat.com>
  • Loading branch information
jwhonce committed May 22, 2020
1 parent a6ee8bf commit 6f5bc71
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/api/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 6f5bc71

Please sign in to comment.