1212from .protocols import HTTPCycle , LifespanCycle
1313from .types import ASGIApp
1414
15+
1516if TYPE_CHECKING : # pragma: no cover
1617 from awslambdaric .lambda_context import LambdaContext
1718
19+
1820DEFAULT_TEXT_MIME_TYPES = [
1921 "text/" ,
2022 "application/json" ,
2325 "application/vnd.api+json" ,
2426]
2527
28+
2629logger = logging .getLogger ("mangum" )
2730
2831
@@ -34,8 +37,6 @@ class Mangum:
3437 specification. This will usually be an ASGI framework application instance.
3538 * **lifespan** - A string to configure lifespan support. Choices are `auto`, `on`,
3639 and `off`. Default is `auto`.
37- * **log_level** - A string to configure the log level. Choices are: `info`,
38- `critical`, `error`, `warning`, and `debug`. Default is `info`.
3940 * **text_mime_types** - A list of MIME types to include with the defaults that
4041 should not return a binary response in API Gateway.
4142 """
@@ -44,11 +45,8 @@ class Mangum:
4445 lifespan : str = "auto"
4546
4647 def __init__ (
47- self ,
48- app : ASGIApp ,
49- lifespan : str = "auto" ,
50- ** handler_kwargs : Dict [str , Any ],
51- ):
48+ self , app : ASGIApp , lifespan : str = "auto" , ** handler_kwargs : Dict [str , Any ]
49+ ) -> None :
5250 self .app = app
5351 self .lifespan = lifespan
5452 self .handler_kwargs = handler_kwargs
@@ -69,7 +67,7 @@ def __call__(self, event: dict, context: "LambdaContext") -> dict:
6967 handler = AbstractHandler .from_trigger (
7068 event , context , ** self .handler_kwargs
7169 )
72- http_cycle = HTTPCycle (handler .scope )
70+ http_cycle = HTTPCycle (handler .request )
7371 response = http_cycle (self .app , handler .body )
7472
7573 return handler .transform_response (response )
0 commit comments