-
-
Notifications
You must be signed in to change notification settings - Fork 107
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
Add Router option 'automatic405' that emits a 405 Method Not Allowed error upon valid path with no matching method #106
Conversation
…plus an extra test
…ap wasnt returning value
I would prefer a config field name that uses words (e.g. "MethodNotFound" instead of "405"). That seems more consistent with existing options. But I'm not an authority on the design here so don't make changes based just on my opinion 😄 |
Bumping this to consider merging! Today heard that someone at work spent a day fruitlessly trying to debug a route 404, when a 405 would've hat tipped them to the method switch typo they made. |
I am not entirely sure, but I think this is not a feature for the router but instead would be a feature for frameworks using the router (ex. |
I will take a look at implementing in Express and write back. Thanks! |
We are working toward the v5 major so I would guess this will not land or be looked at until after. Just want to level set expectations. FWIW it might be better to propose a plan in one of the existing issues around 405 behavior we can make sure it makes sense so you don't waste any of your time. But yeah this sounds great! |
I have seen past PRs and several past issues related to this. 405's are useful for debugging/testing so I found this worthwhile.
Here's what I did:
I know this issue has been kicking around for a long time, and that several people have tried and left off PRs so hoping this is a useful and well-tested contribution for people who choose to have broad 405 coverage, as opposed to a breaking change!