Skip to content

feat: allow conditional revalidation for QUERY requests (v4)#7377

Merged
bjohansebas merged 2 commits into
expressjs:4.xfrom
Cherry:feat/fresh-query-method-4.x
Jul 12, 2026
Merged

feat: allow conditional revalidation for QUERY requests (v4)#7377
bjohansebas merged 2 commits into
expressjs:4.xfrom
Cherry:feat/fresh-query-method-4.x

Conversation

@Cherry

@Cherry Cherry commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Identical to #7366 but targeting the v4 branch as requested at #7365 (comment). Below is a copy of that PR's description:


req.fresh only performed weak freshness validation for GET and HEAD, so responses to QUERY requests never returned 304 Not Modified even when the client sent a matching If-None-Match. This extends the method guard to include QUERY.

-  // GET or HEAD for weak freshness validation only
-  if ('GET' !== method && 'HEAD' !== method) return false;
+  // GET, HEAD, or QUERY for weak freshness validation only
+  if ('GET' !== method && 'HEAD' !== method && 'QUERY' !== method) return false;

As far as I can tell, QUERY is a safe, idempotent, cacheable method whose responses explicitly support conditional revalidation, as per https://datatracker.ietf.org/doc/rfc10008/, so it should behave like GET/HEAD here.

@Cherry Cherry changed the title feat: allow conditional revalidation for QUERY requests feat: allow conditional revalidation for QUERY requests (v4) Jul 12, 2026

@bjohansebas bjohansebas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@bjohansebas bjohansebas added semver-patch This change is a semver patch and removed pr labels Jul 12, 2026
@bjohansebas bjohansebas merged commit 61ccf2e into expressjs:4.x Jul 12, 2026
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.x semver-patch This change is a semver patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants