summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Merickel <michael@merickel.org>2018-01-09 13:24:53 -0600
committerMichael Merickel <michael@merickel.org>2018-01-09 13:26:59 -0600
commit05208c47f0290dbb1ed7f027a147b0ee5712c841 (patch)
treee9bc2d80254249e3498362227007cf74c1f706bd
parent3fa9632225ae4321178a21935669a2cda2610c18 (diff)
downloadwebob-immutable-cache-control.tar.gz
add support for immutable cache-control response headerimmutable-cache-control
-rw-r--r--CHANGES.txt7
-rw-r--r--src/webob/cachecontrol.py1
-rw-r--r--tests/test_cachecontrol.py3
3 files changed, 10 insertions, 1 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 8b5a51c..b44298e 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,10 @@
+unreleased
+----------
+
+- Support setting the ``Cache-Control: immutable`` response header via
+ ``response.cache_control.immutable = True`` and
+ ``response.cache_expires(immutable=True)``.
+
1.8.0rc1 (2018-01-01)
---------------------
diff --git a/src/webob/cachecontrol.py b/src/webob/cachecontrol.py
index 9176ec9..45df7ba 100644
--- a/src/webob/cachecontrol.py
+++ b/src/webob/cachecontrol.py
@@ -205,6 +205,7 @@ class CacheControl(object):
stale_while_revalidate = value_property(
'stale-while-revalidate', type='response')
stale_if_error = value_property('stale-if-error', type='response')
+ immutable = exists_property('immutable', type='response')
def __str__(self):
return serialize_cache_control(self.properties)
diff --git a/tests/test_cachecontrol.py b/tests/test_cachecontrol.py
index 04ddaa6..ce299d9 100644
--- a/tests/test_cachecontrol.py
+++ b/tests/test_cachecontrol.py
@@ -227,10 +227,11 @@ class TestCacheControl(object):
def test_parse(self):
from webob.cachecontrol import CacheControl
- cc = CacheControl.parse("public, max-age=315360000")
+ cc = CacheControl.parse("public, max-age=315360000, immutable")
assert type(cc) == CacheControl
assert cc.max_age == 315360000
assert cc.public is True
+ assert cc.immutable is True
def test_parse_updates_to(self):
from webob.cachecontrol import CacheControl