| 439 | self.on_response = lambda: None |
| 440 | |
| 441 | async def send_500_response(self) -> None: |
| 442 | response_start_event: HTTPResponseStartEvent = { |
| 443 | "type": "http.response.start", |
| 444 | "status": 500, |
| 445 | "headers": [ |
| 446 | (b"content-type", b"text/plain; charset=utf-8"), |
| 447 | (b"connection", b"close"), |
| 448 | ], |
| 449 | } |
| 450 | await self.send(response_start_event) |
| 451 | response_body_event: HTTPResponseBodyEvent = { |
| 452 | "type": "http.response.body", |
| 453 | "body": b"Internal Server Error", |
| 454 | "more_body": False, |
| 455 | } |
| 456 | await self.send(response_body_event) |
| 457 | |
| 458 | # ASGI interface |
| 459 | async def send(self, message: ASGISendEvent) -> None: |