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

Function app_poll_disconnect

tests/middleware/test_base.py:1171–1177  ·  view source on GitHub ↗
(scope: Scope, receive: Receive, send: Send)

Source from the content-addressed store, hash-verified

1169@pytest.mark.parametrize("send_body", [True, False])
1170async def test_poll_for_disconnect_repeated(send_body: bool) -> None:
1171 async def app_poll_disconnect(scope: Scope, receive: Receive, send: Send) -> None:
1172 for _ in range(2):
1173 msg = await receive()
1174 while msg["type"] == "http.request":
1175 msg = await receive()
1176 assert msg["type"] == "http.disconnect"
1177 await Response(b"good!")(scope, receive, send)
1178
1179 class MyMiddleware(BaseHTTPMiddleware):
1180 async def dispatch(self, request: Request, call_next: RequestResponseEndpoint) -> Response:

Callers

nothing calls this directly

Calls 2

ResponseClass · 0.90
receiveFunction · 0.70

Tested by

no test coverage detected