Add HTTP QUERY method (RFC 10008) - #474
Conversation
|
Implements / tracks feature request: #475 Related IDF issue: espressif/esp-idf#19072 |
willmmiles
left a comment
There was a problem hiding this comment.
Seems like a simple and low cost extension to me. The documentation was a bit bungled, though.
|
Addressed the review on
|
There was a problem hiding this comment.
🟡 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
QUERYandAccept-Queryliterals. - 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.
|
@EyJunge1 : could you please rebase ? I have pushed a commit on main to fix the build with Libretiny... Thanks! |
|
@willmmiles we can merge once you approve 👍 |
willmmiles
left a comment
There was a problem hiding this comment.
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.
e5807d2 to
4246dec
Compare
|
@willmmiles Done |
Summary
HTTP_QUERY(1u << 24) per RFC 10008: safe, idempotent, request body allowed.stringToMethod/methodToStringandT_QUERYsoQUERYis no longer treated asHTTP_INVALID(which aborted the connection).AsyncCallbackJsonWebHandlerdefault mask is unchanged (GET/POST/PUT/PATCH). Enable QUERY withsetMethod(HTTP_QUERY)— seeexamples/arduino/Json/Json.ino.Accept-Queryliteral for responses.No platform
http_methodmapping 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-queryreaches the Json example handlerAsyncCallbackJsonWebHandlerwithoutsetMethod(HTTP_QUERY)does not accept QUERY