feat: support the HTTP QUERY method (RFC 10008) - #159
Open
indrekj wants to merge 1 commit into
Open
Conversation
QUERY is a safe, idempotent request method that carries the query in the request content instead of the URI. Add it to the method bitmask table so routes can match on it, and correct the README method list, which was also missing PURGE.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe documented route methods now include ChangesHTTP method support
Estimated code review effort: 1 (Trivial) | ~5 minutes 🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
QUERYto theMETHODSbitmask table so routes can match on it.RFC 10008 (Proposed Standard) defines
QUERYas a safe and idempotent request method that carries the query in the request content instead of the URI. It is intended for queries that do not fit a URI well — large filter expressions, or ones containing values that should not land in access logs, browser history orRefererheaders — while keepingGET's semantics (cacheable, transparently retryable), which the usualPOST-based workaround gives up.Today the method cannot be routed:
rx:match("/aa", {method = "QUERY"})never matches a route that restricts methods, becauseMETHODS["QUERY"]isniland the type check atradixtree.lua:721fails.radix.new{{paths = {"/aa"}, methods = {"QUERY"}}}errors atradixtree.lua:425—bit.boron anilbitmask.Routes that omit
methodsalready match any method token, so this only affects method-restricted routes.QUERYis appended to the end of the list, so the bitmask values of existing methods are unchanged.This is the same shape of change as #115, which added
PURGE(released in v2.8.2).Tests
t/sanity.tTEST 11 mirrors the existingPURGEtest (TEST 10): a route restricted toQUERYmatches aQUERYrequest and nothing else. The followingIteratortest is renumbered 11 → 12.Drive-by doc fix
The
methodsrow in README's route-options table listed valid values asGET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS, CONNECT, TRACE— it never picked upPURGE. Updated to match the code, includingQUERY.Downstream note
Apache APISIX validates route
methodsagainst the same list inapisix/schema_def.lua, so addingQUERYthere depends on a release containing this change (its rockspec pinslua-resty-radixtree). Happy to follow up on the APISIX side once this lands.Summary by CodeRabbit
QUERYHTTP method in route matching.QUERYrequests from other methods, including nested paths.PURGEandQUERYamong the valid HTTP methods for routes.QUERYmatching behavior and preventing unintended matches for other methods or paths.