feat(core): add HTTP QUERY method support
CI / Build & Test (push) Failing after 4m55s
CI / Build & Test (pull_request) Canceled after 50s

Adds the QUERY method (RFC 10008) — safe and idempotent like GET,
but carries a request body like POST, useful for complex filters
that don't fit in a URL query string.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Zakaria El Orche
2026-08-10 13:09:26 +00:00
co-authored by Claude Sonnet 5
parent 391ae6778e
commit fa0a2d79b4
5 changed files with 30 additions and 1 deletions
@@ -75,6 +75,16 @@ class RequestParserTest {
assertEquals(body, new String(r.body().bytes(), StandardCharsets.UTF_8));
}
@Test
void body_parsed_forQueryMethod() throws IOException {
String body = "{\"filter\":\"active\"}";
String raw = "QUERY / HTTP/1.1\r\nContent-Type: application/json\r\nContent-Length: " + body.length() + "\r\n\r\n" + body;
Request r = new RequestParser().parse(new ByteArrayInputStream(raw.getBytes(StandardCharsets.UTF_8)));
assertNotNull(r);
assertEquals(dev.relism.flash.http.HttpMethod.QUERY, r.method());
assertEquals(body, new String(r.body().bytes(), StandardCharsets.UTF_8));
}
@Test
void body_emptyWhenNoContentLength() throws IOException {
Request r = parse(req("GET / HTTP/1.1", "Host: localhost"));
@@ -34,6 +34,7 @@ class HttpMethodTest {
assertEquals(HttpMethod.TRACE, parse("TRACE"));
assertEquals(HttpMethod.CONNECT, parse("CONNECT"));
assertEquals(HttpMethod.PURGE, parse("PURGE"));
assertEquals(HttpMethod.QUERY, parse("QUERY"));
}
@Test