codeguy/Slim — pull request #376 by njh (2012-08-20 09:35:00+00:00)
Title: Content Negotiation support for Slim

Hello,

I have been waiting for Content Negotiation support in Slim for a while and then needed it again for a new project, so decided to go ahead with implementing it. I know there is a good chance that you won't accept this pull request, but I have already made good use of it and hopefully you can at least make use of some of the code.

Usage example:
http://gist.github.com/3398258

Implementation notes:
* I decided to make a new class 'Slim_Negotiator' to keep the functionality contained, testable and avoid bloating other classes
* I decided to create a respondTo() method on the Slim app object, rather than adding properties to the route, because the code was more readable and also avoids parameter confusion.

There is a test suite with 100% coverage and testing a good range of scenarios.

If you decide to accept the pull then there is still some work required to write some documentation.

nick.