You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "He-Pin (via GitHub)" <gi...@apache.org> on 2026/06/19 04:51:57 UTC

[PR] feat: add RFC 10008 QUERY method and Accept-Query header support [pekko-http]

He-Pin opened a new pull request, #1077:
URL: https://github.com/apache/pekko-http/pull/1077

   ## Summary
   - Add `QUERY` HTTP method constant (safe, idempotent, expects request body per RFC 10008) to both Scala and Java API
   - Add `Accept-Query` modeled response header with enhanced parser supporting RFC 9651 Structured Fields syntax (quoted strings, q-value stripping)
   - Add `query` routing directive for both Scala DSL and Java DSL
   - Add `HttpRequest.QUERY()` factory method for Java API
   - Add documentation page and directional tests
   
   ## Motivation
   [RFC 10008](https://www.rfc-editor.org/rfc/rfc10008) defines the HTTP `QUERY` method as a safe and idempotent method that expects a request body, along with the `Accept-Query` response header. pekko-http should provide first-class support for this standard HTTP method, similar to what [Netty did in PR #16978](https://github.com/netty/netty/pull/16978).
   
   ## Modification
   
   ### Core (http-core)
   - `HttpMethod.scala`: Add `QUERY` to `HttpMethods` (safe=true, idempotent=true, requestEntityAcceptance=Expected)
   - `HttpMethods.java`: Add `QUERY` constant to Java API
   - `HttpRequest.java`: Add `QUERY(String uri)` factory method
   - `headers.scala`: Add `Accept-Query` modeled response header (`Seq[MediaRange]`)
   - `AcceptQuery.java`: New Java API abstract class
   - `HeaderParser.scala`: Register `accept-query` in dispatch
   - `AcceptHeader.scala`: Add `accept-query` parser with RFC 9651 Structured Fields support:
     - Handles both token (`application/json`) and quoted-string (`"application/jsonpath"`) forms
     - Strips q-values (not meaningful for Accept-Query per RFC 10008)
   
   ### Routing (http)
   - `MethodDirectives.scala` (scaladsl): Add `query` directive
   - `MethodDirectives.scala` (javadsl): Add `query` directive
   
   ### Documentation (docs)
   - New `query.md` page for the query method directive
   - Scala and Java examples in doc tests
   
   ### Tests
   - `HttpMethodsSpec`: QUERY method lookup
   - `HttpHeaderSpec`: Accept-Query parsing (token, quoted string, wildcard, q-value stripping, RFC example)
   - `HeaderSpec`: Accept-Query rendering
   - `MethodDirectivesSpec`: query directive routing
   - `MethodDirectivesExamplesSpec` / `MethodDirectivesExamplesTest`: doc examples
   
   ## Result
   Downstream consumers can implement RFC 10008 QUERY method support using built-in constants, headers, parsing, and routing directives.
   
   ## Test plan
   - [x] `sbt "http-core / Test / testOnly org.apache.pekko.http.scaladsl.model.HttpMethodsSpec"` → 6 passed
   - [x] `sbt "http-core / Test / testOnly org.apache.pekko.http.impl.model.parser.HttpHeaderSpec"` → 75 passed
   - [x] `sbt "http-core / Test / testOnly org.apache.pekko.http.scaladsl.model.headers.HeaderSpec"` → 18 passed
   - [x] `sbt "http-tests / Test / testOnly org.apache.pekko.http.scaladsl.server.directives.MethodDirectivesSpec"` → 14 passed
   - [x] `sbt "docs / Test / testOnly docs.http.scaladsl.server.directives.MethodDirectivesExamplesSpec docs.http.javadsl.server.directives.MethodDirectivesExamplesTest"` → 11 passed
   - [x] `sbt "http-core / mimaReportBinaryIssues"` → success
   - [x] `sbt "http / mimaReportBinaryIssues"` → success
   - [x] `git diff --check` → clean
   - [x] scalafmt + javafmt applied
   
   ## References
   Refs https://github.com/netty/netty/pull/16978, https://www.rfc-editor.org/rfc/rfc10008
   
   ### Tests
   - All directional tests pass (see test plan above)
   
   ### References
   Refs https://github.com/netty/netty/pull/16978, Refs https://www.rfc-editor.org/rfc/rfc10008


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [PR] feat: add RFC 10008 QUERY method and Accept-Query header support [pekko-http]

Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin merged PR #1077:
URL: https://github.com/apache/pekko-http/pull/1077


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [PR] feat: add RFC 10008 QUERY method and Accept-Query header support [pekko-http]

Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #1077:
URL: https://github.com/apache/pekko-http/pull/1077#discussion_r3441248486


##########
http-core/src/main/java/org/apache/pekko/http/javadsl/model/headers/AcceptQuery.java:
##########
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * license agreements; and to You under the Apache License, version 2.0:
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0

Review Comment:
   wrong header?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org