Send an error response.
(self, status, message)
| 1396 | self._safe_write(body) |
| 1397 | |
| 1398 | def _send_error_response(self, status, message): |
| 1399 | """Send an error response.""" |
| 1400 | body = message.encode("utf-8") |
| 1401 | response = ( |
| 1402 | f"HTTP/1.1 {status} {message}\r\n" |
| 1403 | f"Content-Type: text/plain\r\n" |
| 1404 | f"Content-Length: {len(body)}\r\n" |
| 1405 | f"Connection: close\r\n" |
| 1406 | f"\r\n" |
| 1407 | ) |
| 1408 | self._safe_write(response.encode("latin-1")) |
| 1409 | self._safe_write(body) |
| 1410 | |
| 1411 | def _get_reason_phrase(self, status): |
| 1412 | """Get HTTP reason phrase for status code.""" |
no test coverage detected