mangum icon indicating copy to clipboard operation
mangum copied to clipboard

`Request.url` does not include the api_gateway_base_path

Open beck3905 opened this issue 1 year ago • 0 comments

I am using Mangum in a Lambda handler behind an API Gateway with a custom domain name. When I instantiate Mangum I provide my base path mapping with the api_gateway_base_path parameter. Inside my handler I reference the Request.url property, but it does not provide the actual URL used for the request because it does not include the API Gateway base path value in the path.

Reading the FastAPI docs it seems that this is what the root_path scope property is supposed to be used for, but in the APIGateway handler class root_path gets set to "".

https://github.com/jordaneremieff/mangum/blob/main/mangum/handlers/api_gateway.py#L101

Would it make sense for the root_path to be set to the api_gateway_base_path value if it is provided?

beck3905 avatar Feb 20 '24 18:02 beck3905