mirror of
https://github.com/django/django.git
synced 2025-10-27 15:46:10 +00:00
[2.1.x] Fixed #29520 -- Fixed test client crash when posting bytes.
Regression inb8a41a2872. Backport of9294110a57from master
This commit is contained in:
@@ -1196,6 +1196,10 @@ class RequestMethodStringDataTests(SimpleTestCase):
|
||||
response = self.client.head('/body/', data='', content_type='application/json')
|
||||
self.assertEqual(response.content, b'')
|
||||
|
||||
def test_json_bytes(self):
|
||||
response = self.client.post('/body/', data=b"{'value': 37}", content_type='application/json')
|
||||
self.assertEqual(response.content, b"{'value': 37}")
|
||||
|
||||
def test_json(self):
|
||||
response = self.client.get('/json_response/')
|
||||
self.assertEqual(response.json(), {'key': 'value'})
|
||||
|
||||
Reference in New Issue
Block a user