Skip to content

add route kwargs - event & context #1956

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

Closed

Conversation

Muthuveerappanv
Copy link

Issue number: #1955

Summary

app.resolve invokes the route as shown here, made changes in the PR, so that it can pass event & context as kwargs to the router function:

def _call_route(self, route: Route, args: Dict[str, str]) -> ResponseBuilder:
"""Actually call the matching route with any provided keyword arguments."""
try:
kwargs = {"event": self.current_event, "context": self.context}
return ResponseBuilder(self._to_response(route.func(**args, **kwargs)), route)

Changes

Please provide a summary of what's being changed

  • api_gateway.py _call_route method updated to pass kwargs for - context & event
  • all tests tied to this functionality have been updated and are passing
  • TBD - docs to be checked, waiting for feedback

User experience

Please share what the user experience looks like before and after this change

Checklist

If your change doesn't seem to apply, please leave them unchecked.

Is this a breaking change? No

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

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.

@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 26, 2023
@boring-cyborg
Copy link

boring-cyborg bot commented Feb 26, 2023

Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need.
In the meantime, check out the #python channel on our AWS Lambda Powertools Discord: Invite link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
event_handlers size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant