mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
New implementation for RequestParams
- no longer subclasses dict - request.args[key] now returns first item, not all items - removed request.raw_args entirely Closes #774
This commit is contained in:
parent
f272cbc65f
commit
81be31322a
6 changed files with 49 additions and 16 deletions
|
|
@ -452,8 +452,18 @@ def test_request_args():
|
|||
request = Request.fake("/foo?multi=1&multi=2&single=3")
|
||||
assert "1" == request.args.get("multi")
|
||||
assert "3" == request.args.get("single")
|
||||
assert "1" == request.args["multi"]
|
||||
assert "3" == request.args["single"]
|
||||
assert ["1", "2"] == request.args.getlist("multi")
|
||||
assert [] == request.args.getlist("missing")
|
||||
assert "multi" in request.args
|
||||
assert "single" in request.args
|
||||
assert "missing" not in request.args
|
||||
expected = ["multi", "single"]
|
||||
assert expected == list(request.args.keys())
|
||||
for i, key in enumerate(request.args):
|
||||
assert expected[i] == key
|
||||
assert 2 == len(request.args)
|
||||
with pytest.raises(KeyError):
|
||||
request.args["missing"]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue