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

Method wrap

starlette/middleware/base.py:119–122  ·  view source on GitHub ↗
(func: Callable[[], Awaitable[T]])

Source from the content-addressed store, hash-verified

117 async with anyio.create_task_group() as task_group:
118
119 async def wrap(func: Callable[[], Awaitable[T]]) -> T:
120 result = await func()
121 task_group.cancel_scope.cancel()
122 return result
123
124 task_group.start_soon(wrap, response_sent.wait)
125 message = await wrap(wrapped_receive)

Callers

nothing calls this directly

Calls 1

funcFunction · 0.85

Tested by

no test coverage detected