chriso/klein.php — pull request #27 by jdck (2011-12-27 16:20:39+00:00)
Title: Support for the X-HTTP-Method-Override header

I have implemented an internal single-page web app at my job. On the client side, it uses backbone.js (javascript MVC library). The client side code calls a Rest API that uses (of course!) klein.

One issue is that all requests send to our servers are routed through a proxy that refuses PUT and DELETE methods. To adress this, backbone.js uses the X-HTTP-Method-Override header. The X-HTTP-Method-Override header overrides the actual method, so that PUT and DELETE requests may be sent with the POST method.

Adding 5 lines of code was enough to support this mechanism. What do you think?