generated from amazon-archives/__template_MIT-0
    
        
        - 
                Notifications
    You must be signed in to change notification settings 
- Fork 455
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
I ran into an issue when using a route with the rule "/" along with strip_prefixes feature.  This rule is unable to trigger due to the path variable being reduced down to an empty string instead of a forward slash.
from aws_lambda_powertools.event_handler.api_gateway import ApiGatewayResolver
app = ApiGatewayResolver(strip_prefixes=["/some-path"])
@app.get('/')
def my_func():
    return {'execution_status':'success'}Expected Behavior
Accessing domain.com/some-path would execute my_func().
Current Behavior
Accessing domain.com/some-path returns a 404.  Of note though, accessing domain.com/some-path/ (note the trailing slash) will execute my_func().
Possible Solution
Add an conditional here which will map an empty string to "/".
Steps to Reproduce (for bugs)
- Set up the code example above
- Set up ApiGateway to use a custom domain, and bind the Lambda to a custom path of some-path
- Visit https://CUSTOMDOMAIN/some-pathandhttps://CUSTOMDOMAIN/some-path/and note the different results
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working