| 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": |