Handshake fails when the Sec-WebSocket-Key header is missing.
(self)
| 424 | ) |
| 425 | |
| 426 | def test_missing_key(self): |
| 427 | """Handshake fails when the Sec-WebSocket-Key header is missing.""" |
| 428 | server = ServerProtocol() |
| 429 | request = make_request() |
| 430 | del request.headers["Sec-WebSocket-Key"] |
| 431 | response = server.accept(request) |
| 432 | server.send_response(response) |
| 433 | |
| 434 | self.assertEqual(response.status_code, 400) |
| 435 | self.assertHandshakeError( |
| 436 | server, |
| 437 | InvalidHeader, |
| 438 | "missing Sec-WebSocket-Key header", |
| 439 | ) |
| 440 | |
| 441 | def test_multiple_key(self): |
| 442 | """Handshake fails when the Sec-WebSocket-Key header is repeated.""" |
nothing calls this directly
no test coverage detected