Skip to content

Commit

Permalink
fixes #362, return 404 when routing to empty mux
Browse files Browse the repository at this point in the history
  • Loading branch information
pkieltyka committed Jan 9, 2019
1 parent aa3b3b5 commit 9861155
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mux.go
Expand Up @@ -60,7 +60,8 @@ func NewMux() *Mux {
func (mx *Mux) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// Ensure the mux has some routes defined on the mux
if mx.handler == nil {
panic("chi: attempting to route to a mux with no handlers.")
mx.NotFoundHandler().ServeHTTP(w, r)
return
}

// Check if a routing context already exists from a parent router.
Expand Down

0 comments on commit 9861155

Please sign in to comment.