Skip to content
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

Return 405 Method Not Allowed for unimplemented HTTP methods #25

Closed
ramsey opened this issue Mar 9, 2012 · 3 comments
Closed

Return 405 Method Not Allowed for unimplemented HTTP methods #25

ramsey opened this issue Mar 9, 2012 · 3 comments
Labels

Comments

@ramsey
Copy link
Contributor

ramsey commented Mar 9, 2012

Consider returning 405 Method Not Allowed when the route exists but the requested HTTP method is not implemented for the route. An Allow header must also be included that lists the implemented/allowed methods. See http://tools.ietf.org/html/rfc2616#section-10.4.6.

@augustohp
Copy link
Member

This could be handled a lot like issue #18. I just haven't put much thought to it yet, but we could do it in a lot of ways:

  • Just throw an RestHttpException with the error code and let the user deal with it
  • Do something like what is proposed in Default "not found" route. #18, implement a Route with it

Despite not being the greatest fan of a pre-declared route for 404, 405 and so on; this is the most straight-forward solution I can think of.

This was referenced Mar 11, 2012
augustohp pushed a commit that referenced this issue Mar 11, 2012
@augustohp
Copy link
Member

Missing the Allow part in the header. I couldn't find a good way of finding all the available methods on the route in a way I didn't feel like ripping my head off (traversing through all the routes again).

@alganet: is there some simple and nice way to do that? Otherwise just a cherry-pick here should do, after ripping my head off, of course.

@ramsey
Copy link
Contributor Author

ramsey commented Mar 11, 2012

Great stuff!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants