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

Method test_subprotocols

tests/test_client.py:167–172  ·  view source on GitHub ↗

connect(subprotocols=...) generates a Sec-WebSocket-Protocol header.

(self)

Source from the content-addressed store, hash-verified

165 self.assertEqual(request.headers["Sec-WebSocket-Extensions"], "x-op; op")
166
167 def test_subprotocols(self):
168 """connect(subprotocols=...) generates a Sec-WebSocket-Protocol header."""
169 client = ClientProtocol(URI, subprotocols=["chat"])
170 request = client.connect()
171
172 self.assertEqual(request.headers["Sec-WebSocket-Protocol"], "chat")
173
174
175@patch("websockets.client.generate_key", return_value=KEY)

Callers

nothing calls this directly

Calls 2

connectMethod · 0.95
ClientProtocolClass · 0.85

Tested by

no test coverage detected