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
This commit is contained in:
Nick Pope 2022-07-22 20:19:24 +01:00 committed by Mariusz Felisiak
parent 63d1cb0092
commit 7a1543d9f6
1 changed files with 2 additions and 1 deletions

View File

@ -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",
}
)