The response cache stores only the body, and until recently replayed it with a hardcoded Content-Type.
Context
Fixed in the follow-up to #221 — this issue tracks the invariant, which nothing currently enforces.
middleware/cache.go now persists status, headers, and body together, so a HIT reproduces what the MISS returned. But there is no test asserting that a newly cached route keeps that property, and the failure is silent: a handler sets Cache-Control, the first caller sees it, every subsequent caller does not, and no test fails.
Scope
- A table-driven test over every
ResponseCache-wrapped route asserting header and status parity between MISS and HIT.
- Make it fail closed: adding a route to the cache without adding it to the table should break the build, so the check cannot rot.
Done when
- Header/status parity is asserted for every cached route, and adding a cached route without covering it fails CI.
The response cache stores only the body, and until recently replayed it with a hardcoded
Content-Type.Context
Fixed in the follow-up to #221 — this issue tracks the invariant, which nothing currently enforces.
middleware/cache.gonow persists status, headers, and body together, so a HIT reproduces what the MISS returned. But there is no test asserting that a newly cached route keeps that property, and the failure is silent: a handler setsCache-Control, the first caller sees it, every subsequent caller does not, and no test fails.Scope
ResponseCache-wrapped route asserting header and status parity between MISS and HIT.Done when