summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPremAnand Lakshmanan <premlaks@PremAnands-MacBook-Pro.local>2016-08-30 16:26:28 -0400
committerTim Graham <timograham@gmail.com>2016-08-30 21:04:33 -0400
commitc41fd66f774b0d67876d3d22beeb783ab5bfa442 (patch)
tree76f68dee0ede06645f8cb42806a4e27bd14bb81a
parent35504f74a8c3b45d308969a77488d11443ce4348 (diff)
Fixed #27113 -- Tested that setting HttpRequest.encoding clears POST.
-rw-r--r--tests/requests/tests.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/requests/tests.py b/tests/requests/tests.py
index 425f93a5be..12f6341777 100644
--- a/tests/requests/tests.py
+++ b/tests/requests/tests.py
@@ -554,6 +554,18 @@ class RequestsTests(SimpleTestCase):
with self.assertRaises(UnreadablePostError):
request.body
+ def test_set_encoding_clears_POST(self):
+ payload = FakePayload('name=Hello Günter')
+ request = WSGIRequest({
+ 'REQUEST_METHOD': 'POST',
+ 'CONTENT_TYPE': 'application/x-www-form-urlencoded',
+ 'CONTENT_LENGTH': len(payload),
+ 'wsgi.input': payload,
+ })
+ self.assertEqual(request.POST, {'name': ['Hello Günter']})
+ request.encoding = 'iso-8859-16'
+ self.assertEqual(request.POST, {'name': ['Hello GĂŒnter']})
+
def test_FILES_connection_error(self):
"""
If wsgi.input.read() raises an exception while trying to read() the