TestIsWebSocketUpgrade | Valid WebSocket upgrade headers | Returns true for valid upgrade requests |
TestIsWebSocketUpgrade (case insensitive) | Headers with mixed case | Correctly identifies WebSocket upgrades regardless of case |
TestIsWebSocketUpgrade (connection with keep-alive) | Multiple connection values | Handles Connection header with multiple values |
TestIsWebSocketUpgrade (missing headers) | Missing Upgrade or Connection headers | Returns false when required headers are absent |
TestComputeAcceptKey | RFC 6455 test vector | Computes correct Sec-WebSocket-Accept value |
TestNew_NonWebSocket | Regular HTTP request | Passes through to next handler without upgrade |
TestWithOptions_ForbiddenOrigin | Origin not in allowed list | Returns 403 Forbidden |
TestWithOptions_AllowedOrigin | Origin in allowed list | Accepts the connection |
TestWithOptions_WildcardOrigin | Wildcard (*) origin | Allows any origin |
TestWithOptions_MissingKey | Missing Sec-WebSocket-Key header | Returns 400 Bad Request |
TestConn_WriteText | Writing text message | Successfully writes text frame |
TestConn_WriteBinary | Writing binary message | Successfully writes binary frame |
TestConn_WriteMessageLengths | Various payload sizes (10, 126, 200, 70000 bytes) | Correctly encodes all payload length formats |
TestConn_Close | Connection close | Sends close frame and closes underlying connection |
TestConn_Ping | Ping message | Sends ping frame with payload |
TestConn_Pong | Pong message | Sends pong frame with payload |
TestConn_ReadMessage (short unmasked text) | Reading unmasked text frame | Correctly parses and returns message |
TestConn_ReadMessage (masked text) | Reading masked text frame | Unmasks and returns correct data |
TestConn_ReadMessageExtendedLength | 200-byte message (2-byte length) | Correctly decodes 126+ byte payloads |
TestConn_ReadMessageVeryLongLength | 70000-byte message (8-byte length) | Correctly decodes 65536+ byte payloads |
TestConn_ReadMessageReadErrors | Incomplete frame data | Returns appropriate errors |
TestWithOptions_Subprotocols | Matching subprotocol | Accepts connection with negotiated subprotocol |
TestWithOptions_SubprotocolNotMatching | Non-matching subprotocol | Proceeds without subprotocol |
TestWithOptions_CustomCheckOrigin | Custom origin validation function | Calls custom validator and respects result |
TestWithOptions_NoOriginsAllowsAll | No origins configured | Allows all origins by default |
TestWithOptions_OriginNotInList | Origin not in whitelist | Returns 403 Forbidden |
TestMessageConstants | Message type constants | Verifies correct constant values per RFC 6455 |
TestErrors | Error types | Validates error messages |