Skip to content

Add HTTP QUERY method (RFC 10008) - #474

Merged
mathieucarbou merged 1 commit into
ESP32Async:mainfrom
EyJunge1:feat/http-query-rfc-10008
Sep 12, 2026
Merged

Add HTTP QUERY method (RFC 10008)#474
mathieucarbou merged 1 commit into
ESP32Async:mainfrom
EyJunge1:feat/http-query-rfc-10008

Conversation

@EyJunge1

@EyJunge1 EyJunge1 commented Sep 11, 2026

Copy link
Copy Markdown

Summary

  • Parse and expose HTTP_QUERY (1u << 24) per RFC 10008: safe, idempotent, request body allowed.
  • stringToMethod / methodToString and T_QUERY so QUERY is no longer treated as HTTP_INVALID (which aborted the connection).
  • AsyncCallbackJsonWebHandler default mask is unchanged (GET/POST/PUT/PATCH). Enable QUERY with setMethod(HTTP_QUERY) — see examples/arduino/Json/Json.ino.
  • Accept-Query literal for responses.

No platform http_method mapping in this PR (waits on an IDF detection criterion).

Feature issue: #475

Related:

Test plan

  • curl -X QUERY -H 'Content-Type: application/json' -d '{"q":1}' http://<device>/json-query reaches the Json example handler
  • AsyncCallbackJsonWebHandler without setMethod(HTTP_QUERY) does not accept QUERY
  • Unknown methods still abort

@EyJunge1

Copy link
Copy Markdown
Author

Implements / tracks feature request: #475

Related IDF issue: espressif/esp-idf#19072
Related IDF PR: espressif/esp-idf#19071

@willmmiles willmmiles left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a simple and low cost extension to me. The documentation was a bit bungled, though.

Comment thread src/AsyncJson.cpp Outdated
Comment thread src/ESPAsyncWebServer.h Outdated
Comment thread docs/requests.md Outdated
@EyJunge1

Copy link
Copy Markdown
Author

Addressed the review on e7cbb2f:

  • Reverted the JsonHandlerMethods constructor cleanup (AsyncJson.cpp matches main).
  • Dropped the HTTP_PARSER_HAS_QUERY platform mapping until IDF settles on a detection criterion. The library parser still recognizes QUERY.
  • Removed the extra docs block under Request Variables. HTTP_QUERY stays in the method() enum list; examples/arduino/Json/Json.ino shows setMethod(HTTP_QUERY).

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Accept-Query is incorrectly treated as a singleton header despite being list-valued.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds RFC 10008 HTTP QUERY method support, including parsing, serialization, documentation, and JSON-handler usage.

Changes:

  • Defines and converts HTTP_QUERY.
  • Adds QUERY and Accept-Query literals.
  • Demonstrates opt-in JSON QUERY handling.
File summaries
File Description
src/WebRequest.cpp Parses and serializes QUERY methods.
src/literals.h Adds QUERY-related literals.
src/ESPAsyncWebServer.h Defines the HTTP_QUERY method bit.
examples/arduino/Json/Json.ino Demonstrates a JSON QUERY endpoint.
docs/requests.md Documents HTTP_QUERY.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/literals.h Outdated
@mathieucarbou

Copy link
Copy Markdown
Member

@EyJunge1 : could you please rebase ? I have pushed a commit on main to fix the build with Libretiny... Thanks!

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The implementation consistently adds opt-in QUERY support without changing existing handler defaults.

Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@mathieucarbou

Copy link
Copy Markdown
Member

@willmmiles we can merge once you approve 👍

@willmmiles willmmiles left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I would recommend squashing.

Recognize QUERY in the request-line parser, expose HTTP_QUERY, and
accept it on AsyncCallbackJsonWebHandler so safe, idempotent queries
can carry a JSON body. Platform http_method mapping is gated until
ESP-IDF/Arduino define HTTP_QUERY.
@EyJunge1
EyJunge1 force-pushed the feat/http-query-rfc-10008 branch from e5807d2 to 4246dec Compare September 12, 2026 15:08
@EyJunge1

Copy link
Copy Markdown
Author

@willmmiles Done

@mathieucarbou
mathieucarbou merged commit 1e29dca into ESP32Async:main Sep 12, 2026
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants