INNER CODE UNIT · Python
_reject
MakazhanAlpamys/Soup · src/soup_cli/ui/app.py:55
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:
await self._app(scope, receive, send)
return
for key, value in scope.get("headers", ()):