Add query helper for HTTP QUERY (RFC 10008) routes - #26
Merged
Merged
Conversation
Kemal gained a `query` route DSL in kemalcr/kemal#769, so add the matching spec helper by extending the verb macro with `query`. Specs cover a JSON body, a form-encoded body, an empty body, URL params, and the `400` Kemal returns for a body without a `Content-Type` header. Needs a Kemal version that ships QUERY support.
Member
Author
|
CI is failing since QUERY isn't in kemal v1.12. Tests pass locally when I pull kemal's main branch instead, so this should be resolved after the next official release. I'll merge then. |
hahwul
marked this pull request as ready for review
August 30, 2026 02:20
Kemal validates the WebSocket handshake `Origin` against the request `Host` and answers 403 when it is missing or does not match. `websocket_request_headers` sent neither, so every WebSocket spec broke as soon as that landed in Kemal — and `connect_websocket` did not fail, it hung: only `HTTP::Server::Response#upgrade` writes its 101 out on its own, so a rejected handshake stayed in the response buffer and the read of the client socket blocked forever. CI held all 18 matrix jobs until GitHub's 6 hour limit. - `websocket_request_headers` now defaults to `Host: localhost` and `Origin: http://localhost`. `origin:` still overrides it; delete `Origin` from the returned headers to test the missing-header path. - `inner_connect_websocket` closes the response when there is no upgrade handler, so a rejected handshake raises with its status instead of hanging, and `response` holds the rejection. - CI gets `timeout-minutes: 10` so a blocked spec fails in minutes. Specs cover the cross-origin 403, the missing-Origin 403, an allowlisted cross-origin 101, and the rejected-handshake raise.
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.
Kemal gained a
queryroute DSL in kemalcr/kemal#769, so add the matching spec helper by extending the verb macro withquery.Specs cover a JSON body, a form-encoded body, an empty body, URL params, and the
400Kemal returns for a body without aContent-Typeheader.Needs a Kemal version that ships QUERY support.