feat(core): add HTTP QUERY method support
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:
co-authored by
Claude Sonnet 5
parent
391ae6778e
commit
fa0a2d79b4
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user