[text] add second argument to 'parse_query_list()' (#7138)

return only values whose name is in 'as_list' as a list
This commit is contained in:
Mike Fährmann
2025-03-10 09:36:50 +01:00
parent a859abf6a1
commit 04464b6cf0
5 changed files with 19 additions and 28 deletions

View File

@@ -431,10 +431,10 @@ class TestText(unittest.TestCase):
self.assertEqual(f("foo=1&bar&baz=3"), {"foo": "1", "baz": "3"})
# keys with identical names
self.assertEqual(f("foo=1&foo=2"), {"foo": ["1", "2"]})
self.assertEqual(f("foo=1&foo=2", ("foo",)), {"foo": ["1", "2"]})
self.assertEqual(
f("foo=1&bar=2&foo=3&bar=4&foo=5"),
{"foo": ["1", "3", "5"], "bar": ["2", "4"]},
f("foo=1&bar=2&foo=3&bar=4&foo=5", {"foo", "baz"}),
{"foo": ["1", "3", "5"], "bar": "2"},
)
# invalid arguments