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

Method test_invalid_upgrade

tests/test_client.py:388–399  ·  view source on GitHub ↗

Handshake fails when the Upgrade header is invalid.

(self)

Source from the content-addressed store, hash-verified

386 )
387
388 def test_invalid_upgrade(self):
389 """Handshake fails when the Upgrade header is invalid."""
390 client = ClientProtocol(URI)
391 with alter_and_receive_response(client) as response:
392 del response.headers["Upgrade"]
393 response.headers["Upgrade"] = "h2c"
394
395 self.assertHandshakeError(
396 client,
397 InvalidHeader,
398 "invalid Upgrade header: h2c",
399 )
400
401 def test_missing_accept(self):
402 """Handshake fails when the Sec-WebSocket-Accept header is missing."""

Callers

nothing calls this directly

Calls 3

assertHandshakeErrorMethod · 0.95
ClientProtocolClass · 0.85

Tested by

no test coverage detected