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

Method test_multiple_key

tests/test_server.py:441–454  ·  view source on GitHub ↗

Handshake fails when the Sec-WebSocket-Key header is repeated.

(self)

Source from the content-addressed store, hash-verified

439 )
440
441 def test_multiple_key(self):
442 """Handshake fails when the Sec-WebSocket-Key header is repeated."""
443 server = ServerProtocol()
444 request = make_request()
445 request.headers["Sec-WebSocket-Key"] = KEY
446 response = server.accept(request)
447 server.send_response(response)
448
449 self.assertEqual(response.status_code, 400)
450 self.assertHandshakeError(
451 server,
452 InvalidHeader,
453 "invalid Sec-WebSocket-Key header: multiple values",
454 )
455
456 def test_invalid_key(self):
457 """Handshake fails when the Sec-WebSocket-Key header is invalid."""

Callers

nothing calls this directly

Calls 5

acceptMethod · 0.95
send_responseMethod · 0.95
assertHandshakeErrorMethod · 0.95
ServerProtocolClass · 0.85
make_requestFunction · 0.85

Tested by

no test coverage detected