Generates an error response with ``status_code`` for all requests.
| 2456 | |
| 2457 | |
| 2458 | class ErrorHandler(RequestHandler): |
| 2459 | """Generates an error response with ``status_code`` for all requests.""" |
| 2460 | |
| 2461 | def initialize(self, status_code: int) -> None: |
| 2462 | self.set_status(status_code) |
| 2463 | |
| 2464 | def prepare(self) -> None: |
| 2465 | raise HTTPError(self._status_code) |
| 2466 | |
| 2467 | def check_xsrf_cookie(self) -> None: |
| 2468 | # POSTs to an ErrorHandler don't actually have side effects, |
| 2469 | # so we don't need to check the xsrf token. This allows POSTs |
| 2470 | # to the wrong url to return a 404 instead of 403. |
| 2471 | pass |
| 2472 | |
| 2473 | |
| 2474 | class RedirectHandler(RequestHandler): |
no outgoing calls
no test coverage detected