add api gateway
This commit is contained in:
20
http-api/api_gateway.py
Normal file
20
http-api/api_gateway.py
Normal file
@@ -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,
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user