-
Notifications
You must be signed in to change notification settings - Fork 402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(router): Ignore trailing slashes in route resolvers inherited from APIGatewayResolver #1577
Conversation
Note: I started working on E2E tests - these are unfinished and will take some more time to complete. @heitorlessa you mentioned ALB E2E tests already being defined - I was not able to find can you share a link to the test? |
My bad I forgot to mention it's in the V2 branch: https://github.com/awslabs/aws-lambda-powertools-python/blob/v2/tests/e2e/event_handler/test_header_serializer.py#L39 This was for a breaking change feature @rubenfonseca was doing, but we didn't merge the tests (and optimizations) to There's only one major item pending for V2 (Serverless Application Repository) and we should be good to go. |
Codecov ReportBase: 99.74% // Head: 99.74% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## develop #1577 +/- ##
========================================
Coverage 99.74% 99.74%
========================================
Files 124 124
Lines 5784 5785 +1
Branches 658 658
========================================
+ Hits 5769 5770 +1
Misses 8 8
Partials 7 7
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Ahhh, that makes sense now - nice - it's all in place, so can add my tests pretty quickly - let me move it across. |
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [mypy-boto3-ssm](https://github.com/youtype/mypy_boto3_builder) from 1.24.81 to 1.24.90. - [Release notes](https://github.com/youtype/mypy_boto3_builder/releases) - [Commits](https://github.com/youtype/mypy_boto3_builder/commits) --- updated-dependencies: - dependency-name: mypy-boto3-ssm dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Hope my ramblings below make sense, the TL;DR version goes like this:
The E2E tests are amazing! I have been playing with APIs in various guises today (Much appreciation to the person responsible for writing those!) and have come to some conclusions:
The code in this PR is not up to date as yet since have switched my feature branch to be from V2. Will hopefully push changes tomorrow. |
@heitorlessa - This PR is a little mucked up (my fault) - will re-issue a new PR based on V2 and my feature branch, which is required to fix this up. Have raised new PR - #1609 |
Closing in favour of #1609 |
Issue number: #1552
Summary
Ingore trailing slash for routers inheriting from APIGatewayResolver
Changes
AWS API Gateway routes the following 2 paths in the same way "/my/path", "/my/path/", i.e. when routing "/my/path/" it routes exactly as if "/my/path" had been called. The Lambda Powertools router currently treats these as 2 distinct paths so "/my/path/" returns HTTP statusCode of 404.
User experience
No change to user experience. Users will create routes as normal. In the given sample below making API gateway call to path "/my/path/" will correctly ensure the "get_lambda" route function is correctly called even though it is defined as "/my/path"
The code below will work in the same way when called using path "/my/path", "/my/path/"
Checklist
If your change doesn't seem to apply, please leave them unchecked.
Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.
View rendered docs/core/event_handler/api_gateway.md