MCPcopy Index your code
hub / github.com/modelcontextprotocol/python-sdk / chunked_app

Function chunked_app

tests/interaction/transports/test_bridge.py:23–29  ·  view source on GitHub ↗
(scope: Scope, receive: Receive, send: Send)

Source from the content-addressed store, hash-verified

21 """Each body chunk is delivered as sent, empty chunks are skipped, and the stream ends with the application."""
22
23 async def chunked_app(scope: Scope, receive: Receive, send: Send) -> None:
24 assert scope["type"] == "http"
25 assert (await receive())["type"] == "http.request"
26 await send({"type": "http.response.start", "status": 200, "headers": [(b"content-type", b"text/plain")]})
27 await send({"type": "http.response.body", "body": b"first", "more_body": True})
28 await send({"type": "http.response.body", "body": b"", "more_body": True})
29 await send({"type": "http.response.body", "body": b"second", "more_body": False})
30
31 async with (
32 httpx.AsyncClient(transport=StreamingASGITransport(chunked_app), base_url="http://bridge") as http,

Callers

nothing calls this directly

Calls 2

receiveFunction · 0.50
sendFunction · 0.50

Tested by

no test coverage detected