[v2] Dispatcher/ServerRunner receive-path swap — replaces BaseSession (#2710)
This commit is contained in:
parent
b478bff56d
commit
5d826490b6
2 changed files with 6594 additions and 1701 deletions
|
|
@ -163,4 +163,4 @@ async def test_roots_list_changed_reaches_server_handler(connect: Connect) -> No
|
|||
with anyio.fail_after(5):
|
||||
await delivered.wait()
|
||||
|
||||
assert received == snapshot([None])
|
||||
assert received == snapshot([types.NotificationParams()])
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ import httpx
|
|||
from anyio.streams.memory import MemoryObjectReceiveStream
|
||||
from starlette.types import ASGIApp, Message, Scope
|
||||
|
||||
from mcp.shared._compat import resync_tracer
|
||||
|
||||
|
||||
class _StreamingResponseBody(httpx.AsyncByteStream):
|
||||
"""A response body that yields chunks as the application produces them.
|
||||
|
|
@ -88,6 +90,7 @@ class StreamingASGITransport(httpx.AsyncBaseTransport):
|
|||
if self._cancel_on_close:
|
||||
self._task_group.cancel_scope.cancel()
|
||||
await self._task_group.__aexit__(exc_type, exc_value, traceback)
|
||||
await resync_tracer()
|
||||
|
||||
async def handle_async_request(self, request: httpx.Request) -> httpx.Response:
|
||||
assert isinstance(request.stream, httpx.AsyncByteStream)
|
||||
|
|
|
|||
Loading…
Reference in a new issue