toastdriven/django-tastypie — pull request #359 by ross (2012-02-09 00:15:34+00:00)
Title: set 'Vary: Accept' on the response for caching

since the "Content-Type" returned can change based on the "Accept" header "Vary: Accept" needs to be set on the response to prevent caches from (wrongly) returning an unexpected cached version.

not an issue when using format=XXX since that changes the path.

this also affects django's page_cache if/when it's used to do request/response-level caching of resources. doing this can result in HUGE performance gains, if your use-case can accept the behavior. currently i have to override wrap_view to "decorate" Resource.wrap_view with cache_page to do this (going to look to see if i can come up with a cleaner way to go about this.)