mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #31789 -- Added a new headers interface to HttpResponse.
This commit is contained in:
committed by
Mariusz Felisiak
parent
71ae1ab012
commit
bcc2befd0e
@@ -122,13 +122,13 @@ class SimpleTemplateResponseTest(SimpleTestCase):
|
||||
|
||||
def test_kwargs(self):
|
||||
response = self._response(content_type='application/json', status=504, charset='ascii')
|
||||
self.assertEqual(response['content-type'], 'application/json')
|
||||
self.assertEqual(response.headers['content-type'], 'application/json')
|
||||
self.assertEqual(response.status_code, 504)
|
||||
self.assertEqual(response.charset, 'ascii')
|
||||
|
||||
def test_args(self):
|
||||
response = SimpleTemplateResponse('', {}, 'application/json', 504)
|
||||
self.assertEqual(response['content-type'], 'application/json')
|
||||
self.assertEqual(response.headers['content-type'], 'application/json')
|
||||
self.assertEqual(response.status_code, 504)
|
||||
|
||||
@require_jinja2
|
||||
@@ -175,7 +175,7 @@ class SimpleTemplateResponseTest(SimpleTestCase):
|
||||
unpickled_response = pickle.loads(pickled_response)
|
||||
|
||||
self.assertEqual(unpickled_response.content, response.content)
|
||||
self.assertEqual(unpickled_response['content-type'], response['content-type'])
|
||||
self.assertEqual(unpickled_response.headers['content-type'], response.headers['content-type'])
|
||||
self.assertEqual(unpickled_response.status_code, response.status_code)
|
||||
|
||||
# ...and the unpickled response doesn't have the
|
||||
@@ -249,13 +249,13 @@ class TemplateResponseTest(SimpleTestCase):
|
||||
|
||||
def test_kwargs(self):
|
||||
response = self._response(content_type='application/json', status=504)
|
||||
self.assertEqual(response['content-type'], 'application/json')
|
||||
self.assertEqual(response.headers['content-type'], 'application/json')
|
||||
self.assertEqual(response.status_code, 504)
|
||||
|
||||
def test_args(self):
|
||||
response = TemplateResponse(self.factory.get('/'), '', {},
|
||||
'application/json', 504)
|
||||
self.assertEqual(response['content-type'], 'application/json')
|
||||
self.assertEqual(response.headers['content-type'], 'application/json')
|
||||
self.assertEqual(response.status_code, 504)
|
||||
|
||||
@require_jinja2
|
||||
@@ -287,7 +287,7 @@ class TemplateResponseTest(SimpleTestCase):
|
||||
unpickled_response = pickle.loads(pickled_response)
|
||||
|
||||
self.assertEqual(unpickled_response.content, response.content)
|
||||
self.assertEqual(unpickled_response['content-type'], response['content-type'])
|
||||
self.assertEqual(unpickled_response.headers['content-type'], response.headers['content-type'])
|
||||
self.assertEqual(unpickled_response.status_code, response.status_code)
|
||||
|
||||
# ...and the unpickled response doesn't have the
|
||||
|
||||
Reference in New Issue
Block a user