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

Method Matching - 405 Error Handling #56

Merged
merged 2 commits into from
Nov 14, 2012
Merged

Conversation

Rican7
Copy link
Member

@Rican7 Rican7 commented Nov 2, 2012

These are my proposed changes for issue #50

I followed your (@chriso) testing model to make sure I wasn't slowing down the router with any of the extra logic. The performance is still amazing, as usual.

Essentially, what this code does, is it keeps track of each HTTP Method that is found in any of the matching routes, and passes that data along with each closure.

It also defaults to sending a 405 HTTP code when it finds that 1 or more of the routers/responders COULD have matched, if it hadn't had been for using the wrong HTTP Method.

I made sure to enable a 405 route match, so that anyone using the library could override/change/etc the behavior of the router when a 405 occurs.

Error Code Reference - http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#4xx_Client_Error

Now keeping track of the HTTP Methods it would otherwise match, for a more appropriate 405 error.
@chriso
Copy link
Contributor

chriso commented Nov 14, 2012

Great, thanks

chriso added a commit that referenced this pull request Nov 14, 2012
Method Matching - 405 Error Handling
@chriso chriso merged commit 67b3dcf into klein:master Nov 14, 2012
@Rican7
Copy link
Member Author

Rican7 commented Nov 14, 2012

Thank YOU!
I've been excited about this merge. :P

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

Successfully merging this pull request may close these issues.

None yet

2 participants