Tolerate slightly invalid formats in query strings (Fixes #126)

This commit is contained in:
Miguel Grinberg
2023-04-08 17:15:12 +01:00
parent 67798f7dbf
commit a1b061656f
2 changed files with 9 additions and 2 deletions

View File

@@ -45,6 +45,13 @@ class TestRequest(unittest.TestCase):
self.assertEqual(req.args, MultiDict(
{'foo': 'bar', 'abc': 'def', 'x': '/%%'}))
def test_badly_formatted_args(self):
fd = get_request_fd('GET', '/?&foo=bar&abc=def&&&x=%2f%%')
req = Request.create('app', fd, 'addr')
self.assertEqual(req.query_string, '&foo=bar&abc=def&&&x=%2f%%')
self.assertEqual(req.args, MultiDict(
{'foo': 'bar', 'abc': 'def', 'x': '/%%'}))
def test_json(self):
fd = get_request_fd('GET', '/foo', headers={
'Content-Type': 'application/json'}, body='{"foo":"bar"}')