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

Method test_multiple_extensions

tests/test_server.py:785–800  ·  view source on GitHub ↗

Server enables several extensions when the client offers them.

(self)

Source from the content-addressed store, hash-verified

783 self.assertEqual(server.extensions, [OpExtension("that")])
784
785 def test_multiple_extensions(self):
786 """Server enables several extensions when the client offers them."""
787 server = ServerProtocol(
788 extensions=[ServerOpExtensionFactory(), ServerRsv2ExtensionFactory()]
789 )
790 request = make_request()
791 request.headers["Sec-WebSocket-Extensions"] = "x-op; op"
792 request.headers["Sec-WebSocket-Extensions"] = "x-rsv2"
793 response = server.accept(request)
794 server.send_response(response)
795
796 self.assertHandshakeSuccess(server)
797 self.assertEqual(
798 response.headers["Sec-WebSocket-Extensions"], "x-op; op, x-rsv2"
799 )
800 self.assertEqual(server.extensions, [OpExtension(), Rsv2Extension()])
801
802 def test_multiple_extensions_order(self):
803 """Server respects the order of extensions set in its configuration."""

Callers

nothing calls this directly

Calls 9

acceptMethod · 0.95
send_responseMethod · 0.95
ServerProtocolClass · 0.85
make_requestFunction · 0.85
OpExtensionClass · 0.85
Rsv2ExtensionClass · 0.85

Tested by

no test coverage detected