Fixed #29553 -- Made test client set Content-Length header to a string rather than integer.
This commit is contained in:
parent
857f860d56
commit
5bea8d256d
|
@ -401,7 +401,7 @@ class RequestFactory:
|
||||||
}
|
}
|
||||||
if data:
|
if data:
|
||||||
r.update({
|
r.update({
|
||||||
'CONTENT_LENGTH': len(data),
|
'CONTENT_LENGTH': str(len(data)),
|
||||||
'CONTENT_TYPE': content_type,
|
'CONTENT_TYPE': content_type,
|
||||||
'wsgi.input': FakePayload(data),
|
'wsgi.input': FakePayload(data),
|
||||||
})
|
})
|
||||||
|
|
|
@ -228,6 +228,9 @@ Miscellaneous
|
||||||
have existing invalid data and run a migration that recreates a table, you'll
|
have existing invalid data and run a migration that recreates a table, you'll
|
||||||
see ``CHECK constraint failed``.
|
see ``CHECK constraint failed``.
|
||||||
|
|
||||||
|
* For consistency with WSGI servers, the test client now sets the
|
||||||
|
``Content-Length`` header to a string rather than an integer.
|
||||||
|
|
||||||
.. _deprecated-features-2.2:
|
.. _deprecated-features-2.2:
|
||||||
|
|
||||||
Features deprecated in 2.2
|
Features deprecated in 2.2
|
||||||
|
|
|
@ -122,7 +122,7 @@ class ClientTest(TestCase):
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
self.assertEqual(response.templates[0].name, 'PUT Template')
|
self.assertEqual(response.templates[0].name, 'PUT Template')
|
||||||
self.assertEqual(response.context['data'], "{'foo': 'bar'}")
|
self.assertEqual(response.context['data'], "{'foo': 'bar'}")
|
||||||
self.assertEqual(response.context['Content-Length'], 14)
|
self.assertEqual(response.context['Content-Length'], '14')
|
||||||
|
|
||||||
def test_trace(self):
|
def test_trace(self):
|
||||||
"""TRACE a view"""
|
"""TRACE a view"""
|
||||||
|
|
Loading…
Reference in New Issue