Handling Formats Based On Url Extension
Posted by: youve been HAACKED,
on 07 Jan 2009 |
View original | Bookmarked: 0 time(s)
Rob pinged me today asking about how to respond to requests using different formats based on the extension in the URL. More specifically, hed like to respond with HTML if there is no file extension, but with JSON if the URL ended with .json etc... /home/index > HTML /home/index.json > JSON The first thing I wanted to tackle was writing a custom action invoker that would decide based on whats in the route data, how to format the response. This would allow the developer to simply return...