-
Notifications
You must be signed in to change notification settings - Fork 59
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
Unclear how to determine allowed methods per URL, so hard to make a 405 #70
Comments
This leaves out the mechanism whereby the |
That's correct, it does not. In theory it could though, if it recorded the fact that a route did match, but then the method did not. I'd be open to a PR adding such a capability. |
For reference the way I've ended up doing things is in the That's suitably explicit for my situation for now, but I'll keep thinking about a more general solution. |
I think having a special match method, or toggle that returns detailed match info would make it possible to handle this case. ie, instead of None, it'd return a Match object with information on what routes matched, and what checks failed. This way you could examine the object and determine if it was just the method that failed to match and issue a 405. |
Closing due to inactivity. |
When a URL exists, but does not support a particular method (e.g.
DELETE
) the correct response is to return an HTTP 405 response code. Routes doesn't make this immediately easy. By default a mapping that does not match just returnsNone
with no indication that it was because of a failed condition after an initial path match. So what I've had to come up with is something like the following test, which seems cumbersome. Is there a better way?The text was updated successfully, but these errors were encountered: