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

Method dispatch

tests/middleware/test_base.py:610–619  ·  view source on GitHub ↗
(
            self,
            request: Request,
            call_next: RequestResponseEndpoint,
        )

Source from the content-addressed store, hash-verified

608
609 class ConsumingMiddleware(BaseHTTPMiddleware):
610 async def dispatch(
611 self,
612 request: Request,
613 call_next: RequestResponseEndpoint,
614 ) -> Response:
615 expected = [b"a", b""]
616 async for chunk in request.stream():
617 assert chunk == expected.pop(0)
618 assert expected == []
619 return await call_next(request)
620
621 app = Starlette(
622 routes=[Route("/", homepage, methods=["POST"])],

Callers

nothing calls this directly

Calls 4

streamMethod · 0.80
bodyMethod · 0.80
is_disconnectedMethod · 0.80
popMethod · 0.45

Tested by

no test coverage detected