Skip to content

fix(http-cache): send no-cache on misses in NoCache mode - #181

Open
beanow-at-crabnebula wants to merge 1 commit into
06chaynes:mainfrom
beanow-at-crabnebula:fix/no-cache-miss-directive
Open

beanow-at-crabnebula wants to merge 1 commit into
06chaynes:mainfrom
beanow-at-crabnebula:fix/no-cache-miss-directive

Conversation

@beanow-at-crabnebula

@beanow-at-crabnebula beanow-at-crabnebula commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

When CacheMode::NoCache is selected, send Cache-Control: no-cache on local cache misses.
Clarify the mode's header policy and its difference from Fetch.

Worth checking the intent

As noted, this is different from Fetch, which seemed intentional.
If so, this should improve the consistency of the CacheMode::NoCache option.

Because it's a directive about how any intermediate caches like CDNs should treat the request, the difference in behavior between local miss or hit seemed like a bug.

Testing

Tests updated to reflect.

Assisted-by: gpt-6.1-sol

Apply the existing NoCache request directive to buffered and streaming misses.
Clarify intermediary validation, unconditional requests, and the difference
from Fetch's header generation. Require the directive in both existing
reqwest revalidation tests.

### Why

A local cache miss currently sends no freshness directive to intermediaries.
The same mode sends no-cache on a local hit. Make that behavior consistent
without changing header replacement or bypass handling.

### Testing

Both strengthened tests fail before the fix. After the fix, 99 core tests,
55 reqwest tests, and 8 reqwest doc tests pass. Reqwest's 55 tests also pass
with default features disabled. Clippy passes with warnings denied.
Formatting and whitespace checks pass. Strict buffered rustdoc passes.
Strict streaming rustdoc encounters existing unresolved documentation links.

Assisted-by: gpt-6.1-sol
@codecov

codecov Bot commented Oct 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.51%. Comparing base (b1c3fb4) to head (9232bdb).
⚠️ Report is 56 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #181      +/-   ##
==========================================
+ Coverage   85.87%   90.51%   +4.64%     
==========================================
  Files          19       19              
  Lines        7502    11805    +4303     
==========================================
+ Hits         6442    10685    +4243     
- Misses       1060     1120      +60     

☔ View full report in Codecov by Harness.
📢 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.

This branch has not been deployed

No deployments
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