mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
request.full_path property, closes #1184
This commit is contained in:
parent
ed15c9908e
commit
649f48cd70
3 changed files with 38 additions and 5 deletions
|
|
@ -90,3 +90,25 @@ def test_request_url_vars():
|
|||
assert {"name": "cleo"} == Request(
|
||||
dict(scope, url_route={"kwargs": {"name": "cleo"}}), None
|
||||
).url_vars
|
||||
|
||||
|
||||
|
||||
@pytest.mark.parametrize("path,query_string,expected_full_path", [
|
||||
("/", "", "/"),
|
||||
("/", "foo=bar", "/?foo=bar"),
|
||||
("/foo", "bar", "/foo?bar")
|
||||
])
|
||||
def test_request_properties(path, query_string, expected_full_path):
|
||||
scope = {
|
||||
"http_version": "1.1",
|
||||
"method": "POST",
|
||||
"path": path,
|
||||
"raw_path": path.encode("latin-1"),
|
||||
"query_string": query_string.encode("latin-1"),
|
||||
"scheme": "http",
|
||||
"type": "http",
|
||||
}
|
||||
request = Request(scope, None)
|
||||
assert request.path == path
|
||||
assert request.query_string == query_string
|
||||
assert request.full_path == expected_full_path
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue