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 "".
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 theRequest.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 theAPIGateway
handler classroot_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 theapi_gateway_base_path
value if it is provided?