Closed
Description
Expected Behaviour
When having an path like: /token/bXl0b2tlbg==
And a decorator like:
@app_rest.post("/token/")
def post_token(token: str):
..
The resolve should find this function and token parameter should be populated with "bXl0b2tlbg=="
Current Behaviour
When having an path like: /token/bXl0b2tlbg==
And a decorator like:
@app_rest.post("/token/")
def post_token(token: str):
..
The resolve returns 404.
Code snippet
from aws_lambda_powertools.event_handler import APIGatewayRestResolver
app = APIGatewayRestResolver()
minimal_event = {
"path": "/token/bXl0b2tlbg==",
"httpMethod": "POST"
}
@app.post("/token/<token>")
def post_token(token: str):
return {"token": token}
def lambda_handler(event, context):
return app.resolve(event, context)
if __name__ == "__main__":
print(lambda_handler(minimal_event, None))
Possible Solution
Didn't test it but maybe the equal sign is missing from:
SAFE_URI = "-.~()'!*:@,;" # https://www.ietf.org/rfc/rfc3986.txt
Steps to Reproduce
Run the snipper code.
returns 404 instead of 200
AWS Lambda Powertools for Python version
latest
AWS Lambda function runtime
3.9
Packaging format used
PyPi
Debugging logs
No response