Skip to content

feat(cache): allow HTTP QUERY method in Cache API boundary#6857

Open
Utsav7428 wants to merge 1 commit into
cloudflare:mainfrom
Utsav7428:feature/cache-query-method
Open

feat(cache): allow HTTP QUERY method in Cache API boundary#6857
Utsav7428 wants to merge 1 commit into
cloudflare:mainfrom
Utsav7428:feature/cache-query-method

Conversation

@Utsav7428

@Utsav7428 Utsav7428 commented Jul 4, 2026

Copy link
Copy Markdown

What does this PR do?

This PR implements Phase 1 and Phase 2 of supporting the HTTP QUERY method (RFC 10008) in the Cache API boundary.

Previously, Cache::match, put, and delete_ strictly enforced kj::HttpMethod::GET via JSG_REQUIRE and hardcoded validation blocks, resulting in a TypeError at the JavaScript boundary.

Changes included in this PR:

  1. API Boundary: Patched src/workerd/api/cache.c++ to accept kj::HttpMethod::QUERY alongside GET.
  2. Backend Sizing: Updated Cache::match to dynamically extract the Content-Length header for QUERY requests and pass it to the underlying httpClient->request, rather than hardcoding a 0 byte body.
  3. Testing: Added a JavaScript operation test for QUERY and updated the tail:test telemetry expectations to account for the 3 new cache operation spans (cache_put, cache_match, cache_delete).

Architectural Context

This PR establishes the baseline routing for QUERY. It is fully tested and ready for review. The actual body-stream pumping (Phase 3) will be handled in a separate follow-up PR to keep this review focused and isolated. I am opening this as a Draft to invite feedback on this architectural approach.

Testing

  • Baseline cache-test suite passes.
  • Telemetry assertions (tail:test) updated and passing.
  • Verified C++ backend correctly extracts Content-Length locally.

Signed-off-by: Utsav7428 <utsav73629@gmail.com>
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@Utsav7428

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Jul 4, 2026
@Utsav7428 Utsav7428 marked this pull request as ready for review July 4, 2026 14:35
@Utsav7428 Utsav7428 requested review from a team as code owners July 4, 2026 14:35
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.

1 participant