-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Fix apigateway path encoding #7728
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
Conversation
Motivated by a support case.
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 for adding the parity test @joe4dev, we should have a third-party approving this PR 👍
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.
Awesome, great to see this covered with a snapshot @joe4dev @calvernaz ! 🚀
This PR fixes an rest api parity issue related to encoding paths in URL.
Actual behavior
Given the following invocation URL against a rest api (e.g., with
{proxy+}
integration and a lambda function as backend):GET https://{restapi_id}.execute-api.{region}.amazonaws.com/{stage_name}/user/test%2Balias@gmail.com/plus/test+alias@gmail.com?email=test%2Balias@gmail.com
path
:"/{stage_name}/user/test+alias@gmail.com/plus/test+alias@gmail.com?email=test%2Balias@gmail.com"
queryStringParameters.email
:test+alias@gmail.com
Expected behavior
The base
path
should not decode URL encoded characters such as%2B => +
and looks like this in AWS:/user/test%2Balias@gmail.com/plus/test+alias@gmail.com
Implementation
Instead of relying on decoded
request.path
orrequest.full_path
from Werkzeug, we need to compose the invocationpath
manually consisting of a non-decoded base part and a decode params part.Questions
url_params
be None?stage_name
is omitted?