MCPcopy Index your code
hub / github.com/python-websockets/websockets / respond

Method respond

src/websockets/sync/server.py:88–107  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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,

Callers 15

health_checkFunction · 0.45
health_checkFunction · 0.45
health_checkFunction · 0.45
health_checkFunction · 0.45
health_checkFunction · 0.45
health_checkFunction · 0.45
serve_htmlFunction · 0.45
query_param_authFunction · 0.45
cookie_authFunction · 0.45
process_requestFunction · 0.45
redirectMethod · 0.45
not_foundMethod · 0.45

Calls 1

rejectMethod · 0.45

Tested by 10

process_requestMethod · 0.36
process_requestMethod · 0.36
redirectMethod · 0.36
http_responseMethod · 0.36
redirectMethod · 0.36
redirectMethod · 0.36
process_requestMethod · 0.36
process_requestMethod · 0.36
http_responseMethod · 0.36
process_requestMethod · 0.36