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

Method test_missing_connection

tests/test_server.py:360–374  ·  view source on GitHub ↗

Handshake fails when the Connection header is missing.

(self)

Source from the content-addressed store, hash-verified

358 self.assertHandshakeSuccess(server)
359
360 def test_missing_connection(self):
361 """Handshake fails when the Connection header is missing."""
362 server = ServerProtocol()
363 request = make_request()
364 del request.headers["Connection"]
365 response = server.accept(request)
366 server.send_response(response)
367
368 self.assertEqual(response.status_code, 426)
369 self.assertEqual(response.headers["Upgrade"], "websocket")
370 self.assertHandshakeError(
371 server,
372 InvalidUpgrade,
373 "missing Connection header",
374 )
375
376 def test_invalid_connection(self):
377 """Handshake fails when the Connection 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