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