INNER CODE UNIT · Python

__init__

MakazhanAlpamys/Soup · src/soup_cli/ui/app.py:51

    def __init__(self, app, limits: Mapping[str, int] = _BODY_SIZE_LIMITS) -> None:
        self._app = app
        self._limits = limits

    async def _reject(self, scope, receive, send) -> None:
        from starlette.responses import JSONResponse

        response = JSONResponse(
            status_code=413,
            content={"detail": "Request body too large"},
        )
        await response(scope, receive, send)

    async def __call__(self, scope, receive, send) -> None:
        max_body_size = None
        if scope.get("type") == "http" and scope.get("method") == "POST":
            max_body_size = self._limits.get(scope.get("path"))
        if max_body_size is None:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…