Remove CDN Cache-Control headers; fix cross-language sort bug
Mizan's protocol layers (origin Redis cache, Edge Worker) handle caching
autonomously. The origin emits Cache-Control: no-store on ALL responses —
browsers and non-Mizan intermediaries must not cache. The Edge Worker
controls CDN caching via cf object, independent of origin headers.
Also fixes:
- TS localeCompare → byte-order sort (localeCompare is locale-sensitive,
would produce different HMAC keys for non-ASCII params vs Python)
- Python cache_purge: empty {} params no longer treated as falsy
(was inconsistent with JS where {} is truthy)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -52,11 +52,9 @@ describe('Edge Compatibility', () => {
|
||||
|
||||
// ── Cache-Control correctness ───────────────────────────────────────
|
||||
|
||||
test('context GET is cacheable', async () => {
|
||||
test('context GET emits no-store', async () => {
|
||||
const r = await handleContextFetch('user', { userId: '5' })
|
||||
expect(r.headers['Cache-Control']).toContain('public')
|
||||
expect(r.headers['Cache-Control']).toContain('s-maxage')
|
||||
expect(r.headers['Cache-Control']).not.toContain('no-store')
|
||||
expect(r.headers['Cache-Control']).toBe('no-store')
|
||||
})
|
||||
|
||||
test('mutation POST not cacheable', async () => {
|
||||
@@ -253,7 +251,7 @@ describe('Manifest', () => {
|
||||
expect(fn.cache).toBe(60)
|
||||
})
|
||||
|
||||
test('cache=60 sets s-maxage=60', async () => {
|
||||
test('cache=60 still emits no-store on HTTP', async () => {
|
||||
clearRegistry()
|
||||
const Ctx = new ReactContext('live')
|
||||
client({ context: Ctx, cache: 60 }, async function liveFn() {
|
||||
@@ -261,7 +259,7 @@ describe('Manifest', () => {
|
||||
})
|
||||
|
||||
const r = await handleContextFetch('live', {})
|
||||
expect(r.headers['Cache-Control']).toBe('public, max-age=0, s-maxage=60')
|
||||
expect(r.headers['Cache-Control']).toBe('no-store')
|
||||
})
|
||||
|
||||
test('cache=false sets no-store', async () => {
|
||||
|
||||
Reference in New Issue
Block a user