21 lines
568 B
Python
21 lines
568 B
Python
from typing import Generic, Mapping
|
|
|
|
from aws_lambda_powertools.event_handler import Response, content_types
|
|
from aws_lambda_powertools.event_handler.api_gateway import 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,
|
|
)
|