I'm wondering how caching works with content negotiation based API. Since the to get a resource in XML or JSON, the URI will be the same, for example:
http://example.com/bikes/mountain
The service returns JSON / XML based on the Accept type header. How smart are caches?
For example:
- if one client requested this using Accept type to return XML.
- the response is cached by web server for say 1 minute.
- second client requests same resource using Accept type to return JSON
Does caching check accept / content types at all? Or would this result in the JSON requester getting XML data back since thats what the server had cached? I'm hoping this is something so obvious its already been taken care of, otherwise, isn't that a pretty large argument to include .xml / .json in the URI?
I guess my question is basically, can i safely use content negotiation while still using standard caching techniques?