summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2012-08-22 18:06:03 +0200
committerClaude Paroz <claude@2xlibre.net>2012-08-22 20:55:24 +0200
commit7cfe8e8fce7677ec696f42a7d1501a97e8191a3d (patch)
tree1d751731d3c996ba8f6cdeee097300bbff3de51f /tests
parente2b4eddc11b391bc0047032776e9ca7c2f9328b3 (diff)
Fixed #11340 -- Prevented HttpResponseNotModified to have content/content-type
The HTTP 1.1 spec tells that the 304 response MUST NOT contain a message body. Thanks aparajita for the report.
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/httpwrappers/tests.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/regressiontests/httpwrappers/tests.py b/tests/regressiontests/httpwrappers/tests.py
index bbb2518b32..c84b2cd44e 100644
--- a/tests/regressiontests/httpwrappers/tests.py
+++ b/tests/regressiontests/httpwrappers/tests.py
@@ -6,7 +6,7 @@ import pickle
from django.core.exceptions import SuspiciousOperation
from django.http import (QueryDict, HttpResponse, HttpResponseRedirect,
- HttpResponsePermanentRedirect,
+ HttpResponsePermanentRedirect, HttpResponseNotModified,
SimpleCookie, BadHeaderError,
parse_cookie)
from django.utils import six
@@ -330,6 +330,16 @@ class HttpResponseTests(unittest.TestCase):
HttpResponsePermanentRedirect, url)
+class HttpResponseSubclassesTests(unittest.TestCase):
+ def test_not_modified(self):
+ response = HttpResponseNotModified()
+ self.assertEqual(response.status_code, 304)
+ # 304 responses should not have content/content-type
+ with self.assertRaises(AttributeError):
+ response.content = "Hello dear"
+ self.assertNotIn('content-type', response)
+
+
class CookieTests(unittest.TestCase):
def test_encode(self):
"""