Document that @never_cache and add_never_cache_headers() set the Expires header.
The documentation for the @never_cache
decorator says that it sets the Cache-Control header but neglects to mention that it also sets Expires to the current time (if not already set).
Looking at the git blame, the use of Expires for @never_cache
seems to predate the more modern Cache-Control. Is Expires still needed/desired as part of @never_cache
?
It also feels a little bit unexpected that if @never_cache
is going to set Expires as part of its behavior that it would leave alone a pre-existing Expires header that was set to some far future value.
It would be good to add tests for this behavior to the existing tests, both that Expires gets set if not already set and that, if already set, it doesn't get modified, if that is the desired behavior.
Change History
(10)
Easy pickings: |
set
|
Triage Stage: |
Unreviewed → Accepted
|
Type: |
Uncategorized → Cleanup/optimization
|
Summary: |
Formalize @never_cache setting of Expires header → Document that @never_cache and add_never_cache_headers() set the Expires header.
|
Owner: |
changed from nobody to Marcelo Galigniana
|
Status: |
new → assigned
|
Patch needs improvement: |
set
|
Patch needs improvement: |
unset
|
Triage Stage: |
Accepted → Ready for checkin
|
Resolution: |
→ fixed
|
Status: |
assigned → closed
|
Agreed, we should clarify that the
Expires
header is added if it isn't already set inadd_never_cache_headers()
and@never_cache
docs (see relatedpatch_response_headers()
docs). Extra tests are also welcome (as always).