MCPcopy
hub / github.com/encode/starlette / LogRequestBodySize

Class LogRequestBodySize

tests/middleware/test_base.py:1026–1033  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1024 bodies: list[bytes] = []
1025
1026 class LogRequestBodySize(BaseHTTPMiddleware):
1027 async def dispatch(
1028 self,
1029 request: Request,
1030 call_next: RequestResponseEndpoint,
1031 ) -> Response:
1032 print(len(await request.body()))
1033 return await call_next(request)
1034
1035 def replace_body_middleware(app: ASGIApp) -> ASGIApp:
1036 async def wrapped_app(scope: Scope, receive: Receive, send: Send) -> None:

Calls

no outgoing calls

Tested by 1