-
Notifications
You must be signed in to change notification settings - Fork 403
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(apigateway): ignore trailing slashes in routes (APIGatewayRestResolver) #1609
Conversation
I don't get why there are so many conflicts - my actual changes are not that large - will look at rebasing and see if that lowers the madness level. |
@walmsles really sorry about this. As we are getting ready to release v2, we rebased the entire branch from the |
…r APIGatewayRestRsolver
ahhhh, so it's not me, after all, 👀 - I just assumed I was failing hard today 🤣. No problem - My changes are actually across 2 commits so its very self contained. Been learning all along so it's all good - not a problem. |
I have hard reset my fork branches to develop/V2 from upstream and re-applied my changes so will see if can edit this PR and make the adjustment and see what it looks like or you think create a new fork is required? |
You can definitely force push into this PR! Thank you so much :) |
Thankyou 😄 I thought I was going crazy! |
Okay - have managed to wrangle my branches into a fit state of matching upstream now so this is now more sane. Please refer to this comment on prior PR. the TL;DR version:
I have added E2E tests for ALL the API routing implementations on AWS around the behaviour. (👏 👏 👏 on E2E testing efforts - these are amazing!!!) |
…r APIGatewayRestRsolver
Awesome!! Let me know when it's ready to review @walmsles. We're looking to close all V2 activities by tomorrow, and start writing the What's New (new features, non-backward compatible changes, etc.) |
…ed change - can call super static method in python.
Hi @heitorlessa, this is ready for review. I am about to board a flight and will be back online in a couple of hours. |
Awesome, looking into this now! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for getting this implemented fast! I'm torn on whether we need an actual route + registration, since we're only testing the additional slash /
at the end.
I've added some other minor suggestions you can either accept or drop.
Co-authored-by: Heitor Lessa <lessa@amazon.nl>
Remove unnecessary assertions. Co-authored-by: Heitor Lessa <lessa@amazon.nl>
Remove unnecessary assertions Co-authored-by: Heitor Lessa <lessa@amazon.nl>
remove unecessary assertions Co-authored-by: Heitor Lessa <lessa@amazon.nl>
Codecov ReportBase: 99.38% // Head: 99.40% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## v2 #1609 +/- ##
==========================================
+ Coverage 99.38% 99.40% +0.01%
==========================================
Files 125 127 +2
Lines 5731 5842 +111
Branches 359 367 +8
==========================================
+ Hits 5696 5807 +111
+ Misses 18 17 -1
- Partials 17 18 +1
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. |
…ting for trailing slash in E2E tests for all API types and expected behaviours.
LGTM @walmsles. As it's late in ANZ, happy to send the docs and merge it |
Issue number: #1552
Summary
Ignore 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
View rendered MAINTAINERS.md
View rendered README.md
View rendered docs/core/event_handler/api_gateway.md
View rendered docs/core/tracer.md
View rendered docs/index.md
View rendered docs/upgrade.md
View rendered docs/utilities/batch.md
View rendered docs/utilities/idempotency.md
View rendered docs/utilities/parser.md
View rendered docs/utilities/validation.md