mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #21740 -- Allowed test client data to be an empty string
This fixes a regression introduced by 2a31d00933.
Thanks tony-zhu for the report.
This commit is contained in:
@@ -1228,6 +1228,16 @@ class RequestMethodStringDataTests(TestCase):
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(response.content, b'request method: PATCH')
|
||||
|
||||
def test_empty_string_data(self):
|
||||
"Request a view with empty string data via request method GET/POST/HEAD"
|
||||
# Regression test for #21740
|
||||
response = self.client.get('/body/', data='', content_type='application/json')
|
||||
self.assertEqual(response.content, b'')
|
||||
response = self.client.post('/body/', data='', content_type='application/json')
|
||||
self.assertEqual(response.content, b'')
|
||||
response = self.client.head('/body/', data='', content_type='application/json')
|
||||
self.assertEqual(response.content, b'')
|
||||
|
||||
|
||||
@override_settings(ROOT_URLCONF='test_client_regress.urls',)
|
||||
class QueryStringTests(TestCase):
|
||||
|
||||
Reference in New Issue
Block a user