-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Fix SupressNotFound
making subrouters return 404 and add tests for SupressNotFound
#940
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
SupressNotFound
making subrouters 404SupressNotFound
making subrouters return 404 and add tests for SupressNotFound
wow, I was wondering why. Looks great! |
I'm having the same problem, @pkieltyka could you take a look at this? |
@VojtechVitek could you take a look at this? It has been around for a long time. |
@VojtechVitek why hasn't this PR been merged yet? |
This is a pretty glaring bug. I unfortunately spent a couple of hours before realizing this issue |
FYI, this middleware returns 404 instead of 405 for requests with valid paths that have incorrect HTTP methods. Supporting 405 response would require a bigger change within the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you!
Can someone please help me test this PR and verify its behavior? 👀
This fixes #939 by using
NewRouteContext()
to create a new route context before calling theMatch
function.Because of
Match
's behavior of modifying route context, it is necessary to for the route context to be isolated.chi/mux.go
Lines 361 to 362 in 23c395f
Also added tests to enforce this logic.