Skip to content

Add query helper for HTTP QUERY (RFC 10008) routes - #26

Merged
hahwul merged 2 commits into
masterfrom
features/support-for-http-query-method
Aug 30, 2026
Merged

hahwul merged 2 commits into
masterfrom
features/support-for-http-query-method

Conversation

@hahwul

@hahwul hahwul commented Aug 14, 2026

Copy link
Copy Markdown
Member

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.

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.
@hahwul

hahwul commented Aug 14, 2026

Copy link
Copy Markdown
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
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.
@hahwul
hahwul merged commit 2f84f10 into master Aug 30, 2026
38 checks passed
@hahwul
hahwul deleted the features/support-for-http-query-method branch August 30, 2026 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant