-
Notifications
You must be signed in to change notification settings - Fork 408
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(apigw): route regression for non-word and unsafe URI chars (#556)
- Loading branch information
1 parent
a768b68
commit 35e7745
Showing
2 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -701,3 +701,30 @@ def get_network_account(account_id: str, network_id: str): | |
event["resource"] = "/accounts/{account_id}/source_networks/{network_id}" | ||
event["path"] = "/accounts/nested_account/source_networks/network" | ||
app.resolve(event, {}) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"req", | ||
[ | ||
pytest.param(123456789, id="num"), | ||
pytest.param("[email protected]", id="email"), | ||
pytest.param("-._~'!*:@,;()", id="safe-rfc3986"), | ||
pytest.param("%<>[]{}|^", id="unsafe-rfc3986"), | ||
], | ||
) | ||
def test_non_word_chars_route(req): | ||
# GIVEN | ||
app = ApiGatewayResolver() | ||
event = deepcopy(LOAD_GW_EVENT) | ||
|
||
# WHEN | ||
@app.get("/accounts/<account_id>") | ||
def get_account(account_id: str): | ||
assert account_id == f"{req}" | ||
|
||
# THEN | ||
event["resource"] = "/accounts/{account_id}" | ||
event["path"] = f"/accounts/{req}" | ||
|
||
ret = app.resolve(event, None) | ||
assert ret["statusCode"] == 200 |