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