Skip to content

refactor(http/unstable): improve Cache Control parsing and types#7087

Open
tomas-zijdemans wants to merge 9 commits intodenoland:mainfrom
tomas-zijdemans:cache-control-stable
Open

refactor(http/unstable): improve Cache Control parsing and types#7087
tomas-zijdemans wants to merge 9 commits intodenoland:mainfrom
tomas-zijdemans:cache-control-stable

Conversation

@tomas-zijdemans
Copy link
Copy Markdown
Contributor

@tomas-zijdemans tomas-zijdemans commented Apr 7, 2026

  • BREAKING: CacheControl is now a merged mapped type instead of a union
  • staleIfError added to RequestCacheControl (per RFC 5861)
  • Handle backslash escapes inside quoted strings in splitDirectives
  • Normalize no-cache="" and private="" to true instead of []
  • Hoist digit regex to module scope

@github-actions github-actions bot added the http label Apr 7, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.43%. Comparing base (224adef) to head (b2bdefe).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7087   +/-   ##
=======================================
  Coverage   94.42%   94.43%           
=======================================
  Files         630      630           
  Lines       50533    50579   +46     
  Branches     8964     8977   +13     
=======================================
+ Hits        47717    47763   +46     
  Misses       2247     2247           
  Partials      569      569           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tomas-zijdemans tomas-zijdemans changed the title feat(http): stabilize Cache-Control helpers fix(http/unstable): improve Cache Control parsing and types Apr 7, 2026
Copy link
Copy Markdown
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

Nice bug fixes and test coverage. The backslash escape fix, empty field-name normalization, and staleIfError addition are all correct. Main concerns are around the type restructuring and Set removal — see inline comments.

@tomas-zijdemans
Copy link
Copy Markdown
Contributor Author

Agreed. Here's what I did:

  • Restored CacheControlBase
  • Restored Set-based duplicate tracking for readability
  • Restored RFC comment in default case

@tomas-zijdemans tomas-zijdemans changed the title fix(http/unstable): improve Cache Control parsing and types refactor(http/unstable): improve Cache Control parsing and types Apr 9, 2026
Copy link
Copy Markdown
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

The bug fixes here look great — backslash escape handling, empty field-name normalization, and staleIfError on RequestCacheControl are all correct.

However, it looks like the changes you mentioned in your comment (restoring CacheControlBase, Set-based dedup, and the RFC comment in default) haven't been pushed yet — the diff still shows the old state. Could you push those?

@tomas-zijdemans
Copy link
Copy Markdown
Contributor Author

Oh my.. 🫣
Really sorry about that. Pushed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants