summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/utils/cache.py2
-rw-r--r--tests/cache/tests.py1
2 files changed, 2 insertions, 1 deletions
diff --git a/django/utils/cache.py b/django/utils/cache.py
index c8ab96fe3d..eb3aa631ec 100644
--- a/django/utils/cache.py
+++ b/django/utils/cache.py
@@ -63,7 +63,7 @@ def patch_cache_control(response, **kwargs):
else:
return '%s=%s' % (t[0], t[1])
- if response.has_header('Cache-Control'):
+ if response.get('Cache-Control'):
cc = cc_delim_re.split(response['Cache-Control'])
cc = dict(dictitem(el) for el in cc)
else:
diff --git a/tests/cache/tests.py b/tests/cache/tests.py
index 066ffad3e2..ba3745847b 100644
--- a/tests/cache/tests.py
+++ b/tests/cache/tests.py
@@ -1456,6 +1456,7 @@ class CacheUtils(SimpleTestCase):
tests = (
# Initial Cache-Control, kwargs to patch_cache_control, expected Cache-Control parts
(None, {'private': True}, {'private'}),
+ ('', {'private': True}, {'private'}),
# Test whether private/public attributes are mutually exclusive
('private', {'private': True}, {'private'}),