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

Method test_missing_upgrade

tests/test_server.py:393–407  ·  view source on GitHub ↗

Handshake fails when the Upgrade header is missing.

(self)

Source from the content-addressed store, hash-verified

391 )
392
393 def test_missing_upgrade(self):
394 """Handshake fails when the Upgrade header is missing."""
395 server = ServerProtocol()
396 request = make_request()
397 del request.headers["Upgrade"]
398 response = server.accept(request)
399 server.send_response(response)
400
401 self.assertEqual(response.status_code, 426)
402 self.assertEqual(response.headers["Upgrade"], "websocket")
403 self.assertHandshakeError(
404 server,
405 InvalidUpgrade,
406 "missing Upgrade header",
407 )
408
409 def test_invalid_upgrade(self):
410 """Handshake fails when the Upgrade 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