-
-
Notifications
You must be signed in to change notification settings - Fork 16.3k
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
handle 405 #3513
Comments
Hi @wangfengming. Does this conversation help you? pillarjs/router#62 |
It means I need to handle 405 per every route? |
Currently yes. The solution you propose is rather complicated for the router to make assumptions about because of the shear number of combinations the current api supports. Away from my computer right now, but I can try to outline some of what I mean when I get back to one. |
If Router can store the "only matched path route" and/or "matched path and method route" on req, then I can handle 405 with minimal code. Sorry for my poor english. 😂 |
Your english is not poor 😀 Later tonight Ill write some examples of edge cases and why I think it is not that simple. |
It seems that pillarjs/router#34 and pillarjs/router#56 are on the same topic. 🤔 |
I think both of these are generic avenues for achieving the end goal you want. If we go one of those directions then it supersedes this issue. @wangfengming maybe you could comment over there to put pressure on moving those forward? |
PR #2703 is already opened which allows router and route to be configured for automatically responding with status 405 and is added to 4.17 milestone 👍 |
I'm going to close this as it seems to be answered/resolved and hasn't had any activity in over a year. |
How to handle 405?
Here is a simple way:
insert the code on https://github.com/expressjs/express/blob/master/lib/router/index.js#L253
then I can handle 405 by:
The text was updated successfully, but these errors were encountered: