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

Method stream_response

starlette/responses.py:248–255  ·  starlette/responses.py::StreamingResponse.stream_response
(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({class="st">"type": class="st">"http.response.start", class="st">"status": self.status_code, class="st">"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({class="st">"type": class="st">"http.response.body", class="st">"body": chunk, class="st">"more_body": True})
254
255 await send({class="st">"type": class="st">"http.response.body", class="st">"body": bclass="st">"", class="st">"more_body": False})
256
257 async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
258 if scope[class="st">"type"] == class="st">"websocket":

Callers 1

__call__Method · 0.95

Calls 1

sendFunction · 0.50

Tested by

no test coverage detected