diff options
author | Claude Paroz <claude@2xlibre.net> | 2014-10-20 22:32:43 +0200 |
---|---|---|
committer | Claude Paroz <claude@2xlibre.net> | 2014-10-21 09:16:57 +0200 |
commit | f0bb3c98cc9e128cb0c1622be9eb41a26794c91f (patch) | |
tree | 9d36849565751d4310e7a10754483b9f697db208 /tests/test_client_regress | |
parent | edcb33c92e11ad5ac92a928e65b7d321fa9d067c (diff) | |
download | django-f0bb3c98cc9e128cb0c1622be9eb41a26794c91f.tar.gz |
Fixed #21740 -- Allowed test client data to be an empty string
This fixes a regression introduced by 2a31d00933.
Thanks tony-zhu for the report.
Diffstat (limited to 'tests/test_client_regress')
-rw-r--r-- | tests/test_client_regress/tests.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_client_regress/tests.py b/tests/test_client_regress/tests.py index e5dfffe570..b3656e4963 100644 --- a/tests/test_client_regress/tests.py +++ b/tests/test_client_regress/tests.py @@ -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): |