summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/views/decorators/http.py2
-rw-r--r--tests/regressiontests/conditional_processing/models.py8
2 files changed, 9 insertions, 1 deletions
diff --git a/django/views/decorators/http.py b/django/views/decorators/http.py
index ec4695367b..596409dd90 100644
--- a/django/views/decorators/http.py
+++ b/django/views/decorators/http.py
@@ -75,7 +75,7 @@ def condition(etag_func=None, last_modified_func=None):
if if_none_match or if_match:
# There can be more than one ETag in the request, so we
# consider the list of values.
- etags = parse_etags(if_none_match)
+ etags = parse_etags(if_none_match or if_match)
# Compute values (if any) for the requested resource.
if etag_func:
diff --git a/tests/regressiontests/conditional_processing/models.py b/tests/regressiontests/conditional_processing/models.py
index 5c52acbd52..120a673859 100644
--- a/tests/regressiontests/conditional_processing/models.py
+++ b/tests/regressiontests/conditional_processing/models.py
@@ -50,6 +50,14 @@ class ConditionalGet(TestCase):
response = self.client.get('/condition/')
self.assertNotModified(response)
+ def testIfMatch(self):
+ self.client.defaults['HTTP_IF_MATCH'] = '"%s"' % ETAG
+ response = self.client.put('/condition/etag/', {'data': ''})
+ self.assertEquals(response.status_code, 200)
+ self.client.defaults['HTTP_IF_MATCH'] = '"%s"' % EXPIRED_ETAG
+ response = self.client.put('/condition/etag/', {'data': ''})
+ self.assertEquals(response.status_code, 412)
+
def testBothHeaders(self):
self.client.defaults['HTTP_IF_MODIFIED_SINCE'] = LAST_MODIFIED_STR
self.client.defaults['HTTP_IF_NONE_MATCH'] = '"%s"' % ETAG