From f1020cd3893a0a7786177fd8a32939d765caaec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Rafael=20Siqueira?= Date: Mon, 14 Apr 2025 13:16:17 -0300 Subject: [PATCH] add api gateway --- http-api/api_gateway.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 http-api/api_gateway.py diff --git a/http-api/api_gateway.py b/http-api/api_gateway.py new file mode 100644 index 0000000..255bc2f --- /dev/null +++ b/http-api/api_gateway.py @@ -0,0 +1,20 @@ +from typing import Generic, Mapping + +from aws_lambda_powertools.event_handler import content_types +from aws_lambda_powertools.event_handler.api_gateway import Response, ResponseT + + +class JSONResponse(Response, Generic[ResponseT]): + def __init__( + self, + status_code: int, + body: ResponseT | None = None, + headers: Mapping[str, str | list[str]] | None = None, + ): + super().__init__( + status_code, + content_types.APPLICATION_JSON, + body, + headers, + compress=True, + )