From 7a1543d9f6dd3cac32f0579d8d3b9128c427f531 Mon Sep 17 00:00:00 2001 From: Nick Pope Date: Fri, 22 Jul 2022 20:19:24 +0100 Subject: [PATCH] Refs #33865 -- Made RequestsTests.test_set_encoding_clears_GET use FakePayload. The input stream, wsgi.input, must be a file-like object. The existing implementation of LimitedStream was lax and allowed an empty string to be passed incorrectly. See https://wsgi.readthedocs.io/en/latest/definitions.html#envvar-wsgi.input --- tests/requests/tests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/requests/tests.py b/tests/requests/tests.py index 3cbcefbda7..2d9063f4d1 100644 --- a/tests/requests/tests.py +++ b/tests/requests/tests.py @@ -640,10 +640,11 @@ class RequestsTests(SimpleTestCase): self.assertEqual(request.POST, {"name": ["Hello GĂŒnter"]}) def test_set_encoding_clears_GET(self): + payload = FakePayload("") request = WSGIRequest( { "REQUEST_METHOD": "GET", - "wsgi.input": "", + "wsgi.input": payload, "QUERY_STRING": "name=Hello%20G%C3%BCnter", } )