fix(storage/http): preserve explicit zero maxAge - #329
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe HTTP storage now preserves an explicit ChangesHTTP cache age handling
Estimated code review effort: 1 (Trivial) | ~5 minutes Merge Risk: ⚪ Minimal · up to This localized change preserves an explicitly configured zero cache duration without affecting other maxAge or cache-control behavior; no actionable merge-blocking risk remains after normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
Problem
When an HTTP source response has no
cache-controlheader,ipxHttpStorage({ maxAge: 0 })was coerced to the default300seconds by falsy-value fallback. Deployments intending to disable caching therefore received the wrong cache duration.Fix
Use nullish fallback for the HTTP storage default so an explicit zero is preserved. The option documentation now records that zero disables caching.
Tests
pnpm vitest test/storage/http.test.ts -t 'preserves an explicit zero maxAge'— failed before the fix with300, passed after the fixpnpm vitest test/storage/http.test.ts --run— passed, 90 testspnpm build— passedpnpm test— passed, 453 tests and 9 skippedgit diff HEAD^ HEAD --check— passedCompatibility
Only an explicit
maxAge: 0changes. Nonzero options, environment fallback, and upstreamcache-controlhandling are unchanged; no API or dependency changes are introduced.Related issue
Independent reproduction; no matching open issue was found. Historical cache-control issues #166 and #179 concern different, closed behavior.
Summary by CodeRabbit
Bug Fixes
0, disabling caching instead of applying the default duration.Documentation
0disables caching.