summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2014-10-20 22:32:43 +0200
committerClaude Paroz <claude@2xlibre.net>2014-10-21 09:17:42 +0200
commit53bc81dca3d785d0b399cacbf84cc660355895fc (patch)
treefc2f397646c2b554d9e28c6fc68d4b05965644b3 /tests
parent117e97061093665a50bf35139e25e82da0afdf32 (diff)
[1.7.x] Fixed #21740 -- Allowed test client data to be an empty string
This fixes a regression introduced by 2a31d00933. Thanks tony-zhu for the report. Backport of f0bb3c98cc from master.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_client_regress/tests.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_client_regress/tests.py b/tests/test_client_regress/tests.py
index 604b07624f..c5d3f9b8a1 100644
--- a/tests/test_client_regress/tests.py
+++ b/tests/test_client_regress/tests.py
@@ -1186,6 +1186,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'')
+
class QueryStringTests(TestCase):
urls = 'test_client_regress.urls'