Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements #5
Adds two layers of WebSocket testing for Kemal apps: in-memory upgrade / handshake checks, and duplex tests that run real message exchange over a socket pair.
New helpers
websocket_request_headers— Valid WebSocket upgrade headers; optionalsec_keyandOrigin.get(path, …, websocket: true)— Merges upgrade headers and runs the request throughSpecKemal.process_request. Thewsblock does not run (noupgrade_handler); use this for assertions on 101,Sec-WebSocket-Accept, or 400 / 426 on bad handshakes.connect_websocket— Real upgrade via a connected socket pair (UNIXSocket.pairon Unix, loopback TCP on Windows); invokesresponse.upgrade_handlerlike production, and yields a clientHTTP::WebSocketfor send/receive in the block.inner_connect_websocket— Advanced: access both the client WebSocket and the 101HTTP::Client::Responseinside the block.Example
Assume your app prefixes server replies (so you can tell client send vs server send apart):
wsbody never runs: