Skip to content

Conversation

to-mc
Copy link
Contributor

@to-mc to-mc commented Nov 19, 2021

Issue #, if available: #837

Description of changes:

Allow a list (or tuple) of methods to be passed to the ApiGatewayResolver.route method, to match the functionality in Router.route

Checklist

Breaking change checklist

RFC issue #:

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

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 19, 2021
@pull-request-size pull-request-size bot removed the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 19, 2021
@boring-cyborg boring-cyborg bot added the documentation Improvements or additions to documentation label Nov 19, 2021
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 19, 2021
@to-mc to-mc requested a review from heitorlessa November 19, 2021 15:10
@to-mc to-mc added the bug Something isn't working label Nov 19, 2021
for item in methods:
self._routes[(rule, item, cors, compress, cache_control)] = func
# Convert methods to tuple. It needs to be hashable as its part of the self._routes dict key
methods = (method,) if isinstance(method, str) else tuple(method)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

Copy link
Contributor

@heitorlessa heitorlessa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome one, Tom!

@heitorlessa heitorlessa changed the title fix: allow passing list or tuple for methods to ApiGatewayResolver.route fix(apigateway): allow list/tuple for HTTP methods in route method Nov 19, 2021
@heitorlessa heitorlessa changed the title fix(apigateway): allow list/tuple for HTTP methods in route method fix(apigateway): allow list of HTTP methods in route method Nov 19, 2021
@heitorlessa heitorlessa merged commit fe2cf13 into develop Nov 19, 2021
@heitorlessa heitorlessa deleted the fix/eventhandler_allow_multiple_methods branch November 19, 2021 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation 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.

3 participants