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

Method stream_response

starlette/responses.py:248–255  ·  view source on GitHub ↗
(self, send: Send)

Source from the content-addressed store, hash-verified

246 break
247
248 async def stream_response(self, send: Send) -> None:
249 await send({"type": "http.response.start", "status": self.status_code, "headers": self.raw_headers})
250 async for chunk in self.body_iterator:
251 if not isinstance(chunk, bytes | memoryview):
252 chunk = chunk.encode(self.charset)
253 await send({"type": "http.response.body", "body": chunk, "more_body": True})
254
255 await send({"type": "http.response.body", "body": b"", "more_body": False})
256
257 async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
258 if scope["type"] == "websocket":

Callers 1

__call__Method · 0.95

Calls 1

sendFunction · 0.50

Tested by

no test coverage detected