chriso/klein.php — pull request #56 by Rican7 (2012-11-02 09:27:31+00:00)
Title: Method man

## 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_