You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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 user.HandleFunc("/", allHandler )
- if I only use theNotFound
handler, then the middleware is never set.This feels like a bug - I'd have expected the
r.HandleFunc
to not be needed to register the middleware.The text was updated successfully, but these errors were encountered: