request.args.getlist() returns [] if missing, refs #774

Also added some unit tests for request.args
This commit is contained in:
Simon Willison 2020-05-29 15:51:30 -07:00
commit 84616a2364
4 changed files with 14 additions and 4 deletions

View file

@ -276,4 +276,4 @@ Conider the querystring ``?foo=1&foo=2``. This will produce a ``request.args`` t
Calling ``request.args.get("foo")`` will return the first value, ``"1"``. If that key is not present it will return ``None`` - or the second argument if you passed one, which will be used as the default.
Calling ``request.args.getlist("foo")`` will return the full list, ``["1", "2"]``.
Calling ``request.args.getlist("foo")`` will return the full list, ``["1", "2"]``. If you call it on a missing key it will return ``[]``.