Create a plain text HTTP response. ``process_request`` and ``process_response`` may call this method to return an HTTP response instead of performing the WebSocket opening handshake. You can modify the response before returning it, for example by changing
(self, status: StatusLike, text: str)
| 86 | self.handler_kwargs: Mapping[str, Any] # see route() |
| 87 | |
| 88 | def respond(self, status: StatusLike, text: str) -> Response: |
| 89 | """ |
| 90 | Create a plain text HTTP response. |
| 91 | |
| 92 | ``process_request`` and ``process_response`` may call this method to |
| 93 | return an HTTP response instead of performing the WebSocket opening |
| 94 | handshake. |
| 95 | |
| 96 | You can modify the response before returning it, for example by changing |
| 97 | HTTP headers. |
| 98 | |
| 99 | Args: |
| 100 | status: HTTP status code. |
| 101 | text: HTTP response body; it will be encoded to UTF-8. |
| 102 | |
| 103 | Returns: |
| 104 | HTTP response to send to the client. |
| 105 | |
| 106 | """ |
| 107 | return self.protocol.reject(status, text) |
| 108 | |
| 109 | def handshake( |
| 110 | self, |