aws-lambda-powertools 2.40.2a2__py3-none-any.whl → 2.40.2a4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,6 +30,8 @@ from typing import (
30
30
  cast,
31
31
  )
32
32
 
33
+ from typing_extensions import override
34
+
33
35
  from aws_lambda_powertools.event_handler import content_types
34
36
  from aws_lambda_powertools.event_handler.exceptions import NotFoundError, ServiceError
35
37
  from aws_lambda_powertools.event_handler.openapi.constants import DEFAULT_API_VERSION, DEFAULT_OPENAPI_VERSION
@@ -2652,3 +2654,24 @@ class ALBResolver(ApiGatewayResolver):
2652
2654
  def _get_base_path(self) -> str:
2653
2655
  # ALB doesn't have a stage variable, so we just return an empty string
2654
2656
  return ""
2657
+
2658
+ @override
2659
+ def _to_response(self, result: Union[Dict, Tuple, Response]) -> Response:
2660
+ """Convert the route's result to a Response
2661
+
2662
+ ALB requires a non-null body otherwise it converts as HTTP 5xx
2663
+
2664
+ 3 main result types are supported:
2665
+
2666
+ - Dict[str, Any]: Rest api response with just the Dict to json stringify and content-type is set to
2667
+ application/json
2668
+ - Tuple[dict, int]: Same dict handling as above but with the option of including a status code
2669
+ - Response: returned as is, and allows for more flexibility
2670
+ """
2671
+
2672
+ # NOTE: Minor override for early return on Response with null body for ALB
2673
+ if isinstance(result, Response) and result.body is None:
2674
+ logger.debug("ALB doesn't allow None responses; converting to empty string")
2675
+ result.body = ""
2676
+
2677
+ return super()._to_response(result)
@@ -1,3 +1,3 @@
1
1
  """Exposes version constant to avoid circular dependencies."""
2
2
 
3
- VERSION = "2.40.2a2"
3
+ VERSION = "2.40.2a4"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: aws-lambda-powertools
3
- Version: 2.40.2a2
3
+ Version: 2.40.2a4
4
4
  Summary: Powertools for AWS Lambda (Python) is a developer toolkit to implement Serverless best practices and increase developer velocity.
5
5
  Home-page: https://github.com/aws-powertools/powertools-lambda-python
6
6
  License: MIT
@@ -1,7 +1,7 @@
1
1
  THIRD-PARTY-LICENSES,sha256=Nu1kDwEWpFpCwF8oJSDq2Po4N1tUZ4dzNjYyk_CWFjs,11419
2
2
  aws_lambda_powertools/__init__.py,sha256=bg1kLlNfNIZY2f-SurRlGy0HzpWeZro3JUyCzcIUzrQ,701
3
3
  aws_lambda_powertools/event_handler/__init__.py,sha256=RM4TF62aonr60nVlq4V8ogfjef8RtpUUGuDUfZY34_w,901
4
- aws_lambda_powertools/event_handler/api_gateway.py,sha256=OhasNyNksB-Q_9cT5TNUUCyFlD4uaztXwYOJdHvYOvo,103161
4
+ aws_lambda_powertools/event_handler/api_gateway.py,sha256=7DYgkTCnw_4iwdufGdc9kRzr7eVCl9FORgWvNwtGOE8,104094
5
5
  aws_lambda_powertools/event_handler/appsync.py,sha256=_Dh4nkXsmQg1LYBzL2tNRgUyJHUZmZZpyY31zC068nw,16899
6
6
  aws_lambda_powertools/event_handler/bedrock_agent.py,sha256=kIUs7wUlRV0m3pobS5Tuw7Rm-4E6rj1OBYYQDytTMI8,8705
7
7
  aws_lambda_powertools/event_handler/content_types.py,sha256=0MKsKNu-SSrxbULVKnUjwgK-lVXhVD7BBjZ4Js0kEsI,163
@@ -83,7 +83,7 @@ aws_lambda_powertools/shared/json_encoder.py,sha256=4ILd4gE9RWqbbVyBAMDNDm0JgTpm
83
83
  aws_lambda_powertools/shared/lazy_import.py,sha256=3Jm_ng5lyTI97YAOCeliNDzlxG3gBwszJm0XHGfoQRA,2035
84
84
  aws_lambda_powertools/shared/types.py,sha256=qhpOtwND19KqATlXgSq0yWoca1fehv2uI2oL8B0U6jY,1007
85
85
  aws_lambda_powertools/shared/user_agent.py,sha256=DrCMFQuT4a4iIrpcWpAIjY37EFqR9-QxlxDGD-Nn9Gg,7081
86
- aws_lambda_powertools/shared/version.py,sha256=o3mtk9xMwF7vEOVrfaFRAIK1QQPi4XFCSnGUmARQtUM,85
86
+ aws_lambda_powertools/shared/version.py,sha256=JdsCSfwppzkWbsqvr5cr1mCkSztRtMTB6ha4nBQyrWI,85
87
87
  aws_lambda_powertools/tracing/__init__.py,sha256=Zdk7mE8lUMICbYOnx_1yFjvghzoPOpPmRv-Wkj-kzkU,142
88
88
  aws_lambda_powertools/tracing/base.py,sha256=JysEH9j4_FSQeEAUnx6h43JeyUpLY9aBwxl9bqqEyYI,4390
89
89
  aws_lambda_powertools/tracing/extensions.py,sha256=APOfXOq-hRBKaK5WyfIyrd_6M1_9SWJZ3zxLA9jDZzU,492
@@ -239,7 +239,7 @@ aws_lambda_powertools/utilities/validation/envelopes.py,sha256=YD5HOFx6IClQgii0n
239
239
  aws_lambda_powertools/utilities/validation/exceptions.py,sha256=De_QLn5R4L1qxe4rhbxQNIZWRe6fbdrQS7vqlus6bC0,2047
240
240
  aws_lambda_powertools/utilities/validation/validator.py,sha256=iasiFp-NaBXK0h5qsXWdUKWmCNnGiAVARgUsX2zQtls,9900
241
241
  aws_lambda_powertools/warnings/__init__.py,sha256=1FuRsurql2xg1ovxI2gpfKcTcdcYyfLgEywapO6pzS4,618
242
- aws_lambda_powertools-2.40.2a2.dist-info/LICENSE,sha256=vMHS2eBgmwPUIMPb7LQ4p7ib_FPVQXarVjAasflrTwo,951
243
- aws_lambda_powertools-2.40.2a2.dist-info/METADATA,sha256=CaIOeVMpVodp-0mqGJFO15dXQ14tB0OkKHbQzW7ptiI,10806
244
- aws_lambda_powertools-2.40.2a2.dist-info/WHEEL,sha256=WGfLGfLX43Ei_YORXSnT54hxFygu34kMpcQdmgmEwCQ,88
245
- aws_lambda_powertools-2.40.2a2.dist-info/RECORD,,
242
+ aws_lambda_powertools-2.40.2a4.dist-info/LICENSE,sha256=vMHS2eBgmwPUIMPb7LQ4p7ib_FPVQXarVjAasflrTwo,951
243
+ aws_lambda_powertools-2.40.2a4.dist-info/METADATA,sha256=GaA4y0qEYGk1MWtbEOFfjhUngbHg87NTvBUeWVq6Smg,10806
244
+ aws_lambda_powertools-2.40.2a4.dist-info/WHEEL,sha256=WGfLGfLX43Ei_YORXSnT54hxFygu34kMpcQdmgmEwCQ,88
245
+ aws_lambda_powertools-2.40.2a4.dist-info/RECORD,,