Open
Description
I'm trying to set up a "catch all" route. Anything that goes to "catchall/some/other/thing" should go the allHandler
. I have values that I am setting onto the context in my middleware. These values ONLY show up if I use r.HandleFunc("/", allHandler )
- if I only use the NotFound
handler, then the middleware is never set.
router := chi.NewRouter()
router.Route("/catchall", func(r chi.Router) {
r.Use(MiddlewareSetsContextValues)
r.NotFound(allHandler)
// uncomment the following so it works
// r.HandleFunc("/", allHandler) // wont match ../some/other/thing
})
This feels like a bug - I'd have expected the r.HandleFunc
to not be needed to register the middleware.