Skip to content

Add HTTP QUERY method support (RFC 10008)#1366

Open
ewalsh wants to merge 4 commits into
playframework:mainfrom
ewalsh:feature/http-query-method
Open

Add HTTP QUERY method support (RFC 10008)#1366
ewalsh wants to merge 4 commits into
playframework:mainfrom
ewalsh:feature/http-query-method

Conversation

@ewalsh

@ewalsh ewalsh commented Jul 7, 2026

Copy link
Copy Markdown

Pull Request Checklist

  • Have you read through the contributor guidelines?
  • Have you squashed your commits?
  • Have you added copyright headers to new files?
  • Have you checked that both Scala and Java APIs are updated?
  • Have you updated the documentation for both Scala and Java sections?
  • Have you added tests for any changed functionality?

Purpose

Adds first-class support for the HTTP QUERY method (RFC 10008) to play-ws-standalone.

QUERY is a safe, idempotent method that carries a request body — semantically like GET but with POST-style body support. This is useful for complex search queries that don't fit in a URL query string.

Background Context

The implementation mirrors the existing post/put/patch pattern exactly:

  • Scala trait: def query[T: BodyWritable](body: T): Future[Response]
  • Java interface: CompletionStage<? extends StandaloneWSResponse> query(BodyWritable body)
  • AHC implementations: delegate to withBody(body).execute("QUERY") / setMethod("QUERY").setBody(body).execute()

AHC does not strip the body for custom/unknown method strings — verified via unit tests and integration tests against a mock server.

Changes

File Change
play-ws-standalone/.../StandaloneWSRequest.scala Added query to Scala trait
play-ws-standalone/.../StandaloneWSRequest.java Added query to Java interface
play-ahc-ws-standalone/.../StandaloneAhcWSRequest.scala Scala AHC implementation
play-ahc-ws-standalone/.../StandaloneAhcWSRequest.java Java AHC implementation
build.sbt MiMa exclusions for new abstract method
README.md Usage examples for Scala and Java
Unit tests (Scala + Java) 5 tests verifying method, body, content-type
Integration test End-to-end test against mock server
.gitignore Housekeeping: added .metals/ and .vscode/

Validation

  • sbt validateCode — ✅ (headerCheckAll, scalafmtSbtCheck, scalafmtCheckAll)
  • sbt mimaReportBinaryIssues — ✅ (with exclusions for the new abstract method)
  • sbt +test — ✅ (153 tests pass on both Scala 2.13.18 and 3.3.8)

References

QUERY is a safe, idempotent method that carries a request body —
semantically like GET but with POST-style body support.

- Add query[T: BodyWritable](body: T) to Scala StandaloneWSRequest trait
- Add query(BodyWritable body) to Java StandaloneWSRequest interface
- Add AHC implementations for both Scala and Java
- Add MiMa exclusions for new abstract method
- Add unit tests (Scala + Java) and integration test
- Add README documentation for both Scala and Java
- Housekeeping: add .metals/ and .vscode/ to .gitignore
Comment thread play-ahc-ws-standalone/src/test/scala/play/api/libs/ws/ahc/AhcWSRequestSpec.scala Outdated
Comment thread play-ahc-ws-standalone/src/test/scala/play/api/libs/ws/ahc/AhcWSRequestSpec.scala Outdated
Comment thread play-ahc-ws-standalone/src/test/scala/play/api/libs/ws/ahc/AhcWSRequestSpec.scala Outdated
Comment thread play-ahc-ws-standalone/src/test/scala/play/api/libs/ws/ahc/AhcWSRequestSpec.scala Outdated
Comment thread play-ahc-ws-standalone/src/test/scala/play/libs/ws/ahc/AhcWSRequestSpec.scala Outdated
Comment thread .gitignore Outdated
@ewalsh

ewalsh commented Jul 10, 2026

Copy link
Copy Markdown
Author

Thanks for the review @cchantep! All feedback addressed in the latest push:

# Comment Resolution
1 Empty scaladoc on query impl Added one-liner: /** Performs a QUERY request. */
2–5 Use must_=== / and blocks in Scala tests Applied throughout
6 Use must_=== / and blocks in Java tests Applied
7 .gitignore — IDE specific Reverted entirely

Apologies for the force-push — should have been a fixup commit to preserve review context. Happy to squash on merge if that's the preferred workflow here.

Comment thread .gitignore Outdated
Comment thread integration-tests/src/test/scala/play/api/libs/ws/ahc/AhcWSClientSpec.scala Outdated
Comment thread integration-tests/src/test/scala/play/api/libs/ws/ahc/AhcWSClientSpec.scala Outdated
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.

2 participants