Skip to content

Don't cache aborted responses in ResponseCaching - #69949

Merged
Youssef1313 merged 1 commit into
mainfrom
copilot/mirror-fix-response-caching
Oct 20, 2026
Merged

Youssef1313 merged 1 commit into
mainfrom
copilot/mirror-fix-response-caching

Conversation

Copilot AI commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

This implements the same fix as #68683, but for ResponseCaching here. The old PR only handled OutputCaching. See details from the other PR.

@Youssef1313
Youssef1313 marked this pull request as ready for review October 20, 2026 15:58
Copilot AI balanced review requested due to automatic review settings October 20, 2026 15:58
@github-actions github-actions Bot added the area-middleware Includes: URL rewrite, redirect, response cache/compression, session, and other general middlewares label Oct 20, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Required frozen review evidence was unavailable, leaving approval validation incomplete and requiring human review.

No open issues 🎉

What changed in this PR

Extends the aborted-response safeguard from OutputCaching to ResponseCaching, preventing canceled requests from populating the response cache.

Changes:

  • Checks request cancellation before caching the response body.
  • Adds tests for skipped cache storage and subsequent requests receiving fresh responses.
File Description
src/​Middleware/​ResponseCaching/​test/​ResponseCachingMiddlewareTests.cs Adds aborted-response regression tests.
src/​Middleware/​ResponseCaching/​src/​ResponseCachingMiddleware.cs Prevents caching when the request is canceled.

Review effort: Balanced

@Youssef1313
Youssef1313 merged commit 735f34e into main Oct 20, 2026
29 checks passed
@Youssef1313
Youssef1313 deleted the copilot/mirror-fix-response-caching branch October 20, 2026 21:05
@github-actions

Copy link
Copy Markdown
Contributor

✅ No documentation PR was created.

Confidence that documentation is needed: 10%

No docs needed: internal bug fix that stops ResponseCaching from caching aborted responses, matching an earlier OutputCaching fix.

Documentation surfaces considered

  • Conceptual article: Not required — Bug fix limited to ResponseCachingMiddleware.cs and its tests; no new public API or configuration, and no signals detected.
  • Migration guidance: Not required — No action needed when upgrading.
  • Breaking change: Not required — No compatibility impact; it only avoids caching aborted responses.

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — 953e627b Deployed Oct 20, 2026 by Youssef1313 via conclusion #81
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-middleware Includes: URL rewrite, redirect, response cache/compression, session, and other general middlewares

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants