mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
request.url_vars property, closes #822
This commit is contained in:
parent
db660db463
commit
fac8e93815
5 changed files with 28 additions and 4 deletions
|
|
@ -44,3 +44,20 @@ def test_request_args():
|
|||
assert 2 == len(request.args)
|
||||
with pytest.raises(KeyError):
|
||||
request.args["missing"]
|
||||
|
||||
|
||||
def test_request_url_vars():
|
||||
scope = {
|
||||
"http_version": "1.1",
|
||||
"method": "POST",
|
||||
"path": "/",
|
||||
"raw_path": b"/",
|
||||
"query_string": b"",
|
||||
"scheme": "http",
|
||||
"type": "http",
|
||||
"headers": [[b"content-type", b"application/x-www-form-urlencoded"]],
|
||||
}
|
||||
assert {} == Request(scope, None).url_vars
|
||||
assert {"name": "cleo"} == Request(
|
||||
dict(scope, url_route={"kwargs": {"name": "cleo"}}), None
|
||||
).url_vars
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue