Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c2bc31d

Browse files
authored
chore: rename netlify-cdn-cache-control and netlify-cache-tag (#3058)
1 parent 2bfcafc commit c2bc31d

File tree

7 files changed

+73
-59
lines changed

7 files changed

+73
-59
lines changed

‎tests/e2e/cli-before-regional-blobs-support.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ test('should serve 404 page when requesting non existing page (no matching route
2323
// after that (14.2.10 and canary.147) 404 pages would have `private` directive, before that it
2424
// would not
2525
const shouldHavePrivateDirective = nextVersionSatisfies('^14.2.10 || >=15.0.0-canary.147')
26-
expect(headers['netlify-cdn-cache-control']).toBe(
26+
expect(headers['debug-netlify-cdn-cache-control']).toBe(
2727
(shouldHavePrivateDirective ? 'private, ' : '') +
2828
'no-cache, no-store, max-age=0, must-revalidate, durable',
2929
)

‎tests/e2e/dynamic-cms.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ test.describe('Dynamic CMS', () => {
6060
expect(headers1['cache-status']).toMatch(
6161
/"Next.js";fwd=miss\s*(,|\n)\s*"NetlifyDurable";fwd=uri-miss;stored\s*(,|\n)\s*"NetlifyEdge";fwd=miss/,
6262
)
63-
expect(headers1['netlify-cache-tag']).toEqual(expectedCacheTag)
64-
expect(headers1['netlify-cdn-cache-control']).toMatch(
63+
expect(headers1['debug-netlify-cache-tag']).toEqual(expectedCacheTag)
64+
expect(headers1['debug-netlify-cdn-cache-control']).toMatch(
6565
/s-maxage=31536000,(stale-while-revalidate=31536000,)?durable/,
6666
)
6767

@@ -79,8 +79,8 @@ test.describe('Dynamic CMS', () => {
7979
expect(headers2['cache-status']).toMatch(
8080
/"Next.js";hit\s*(,|\n)\s*"NetlifyDurable";fwd=stale;ttl=[0-9]+;stored\s*(,|\n)\s*"NetlifyEdge";fwd=(stale|miss)/,
8181
)
82-
expect(headers2['netlify-cache-tag']).toEqual(expectedCacheTag)
83-
expect(headers2['netlify-cdn-cache-control']).toMatch(
82+
expect(headers2['debug-netlify-cache-tag']).toEqual(expectedCacheTag)
83+
expect(headers2['debug-netlify-cdn-cache-control']).toMatch(
8484
/s-maxage=31536000,(stale-while-revalidate=31536000,)?durable/,
8585
)
8686

@@ -98,8 +98,8 @@ test.describe('Dynamic CMS', () => {
9898
expect(headers3['cache-status']).toMatch(
9999
/"Next.js";fwd=miss\s*(,|\n)\s*"NetlifyDurable";fwd=stale;ttl=[0-9]+;stored\s*(,|\n)\s*"NetlifyEdge";fwd=(stale|miss)/,
100100
)
101-
expect(headers3['netlify-cache-tag']).toEqual(expectedCacheTag)
102-
expect(headers3['netlify-cdn-cache-control']).toMatch(
101+
expect(headers3['debug-netlify-cache-tag']).toEqual(expectedCacheTag)
102+
expect(headers3['debug-netlify-cdn-cache-control']).toMatch(
103103
/s-maxage=31536000,(stale-while-revalidate=31536000,)?durable/,
104104
)
105105
})

‎tests/e2e/edge-middleware.test.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,13 +392,15 @@ test.describe('RSC cache poisoning', () => {
392392

393393
// ensure prefetch respond with RSC data
394394
expect(prefetchResponse.headers()['content-type']).toMatch(/text\/x-component/)
395-
expect(prefetchResponse.headers()['netlify-cdn-cache-control']).toMatch(/s-maxage=31536000/)
395+
expect(prefetchResponse.headers()['debug-netlify-cdn-cache-control']).toMatch(
396+
/s-maxage=31536000/,
397+
)
396398

397399
const htmlResponse = await page.goto(`${middleware.url}/test/rewrite-to-cached-page`)
398400

399401
// ensure we get HTML response
400402
expect(htmlResponse?.headers()['content-type']).toMatch(/text\/html/)
401-
expect(htmlResponse?.headers()['netlify-cdn-cache-control']).toMatch(/s-maxage=31536000/)
403+
expect(htmlResponse?.headers()['debug-netlify-cdn-cache-control']).toMatch(/s-maxage=31536000/)
402404
})
403405

404406
test('Middleware redirect', async ({ page, middleware }) => {
@@ -419,12 +421,14 @@ test.describe('RSC cache poisoning', () => {
419421

420422
// ensure prefetch respond with RSC data
421423
expect(prefetchResponse.headers()['content-type']).toMatch(/text\/x-component/)
422-
expect(prefetchResponse.headers()['netlify-cdn-cache-control']).toMatch(/s-maxage=31536000/)
424+
expect(prefetchResponse.headers()['debug-netlify-cdn-cache-control']).toMatch(
425+
/s-maxage=31536000/,
426+
)
423427

424428
const htmlResponse = await page.goto(`${middleware.url}/test/redirect-to-cached-page`)
425429

426430
// ensure we get HTML response
427431
expect(htmlResponse?.headers()['content-type']).toMatch(/text\/html/)
428-
expect(htmlResponse?.headers()['netlify-cdn-cache-control']).toMatch(/s-maxage=31536000/)
432+
expect(htmlResponse?.headers()['debug-netlify-cdn-cache-control']).toMatch(/s-maxage=31536000/)
429433
})
430434
})

‎tests/e2e/on-demand-app.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ test.describe('app router on-demand revalidation', () => {
9090
const headers1 = response1?.headers() || {}
9191
expect(response1?.status()).toBe(200)
9292
expect(headers1['x-nextjs-cache']).toBeUndefined()
93-
expect(headers1['netlify-cdn-cache-control']).toBe(
93+
expect(headers1['debug-netlify-cdn-cache-control']).toBe(
9494
nextVersionSatisfies('>=15.0.0-canary.187')
9595
? 's-maxage=31536000, durable'
9696
: 's-maxage=31536000, stale-while-revalidate=31536000, durable',
@@ -120,7 +120,7 @@ test.describe('app router on-demand revalidation', () => {
120120
// as we reuse cached response
121121
expect(headers2['cache-status']).toMatch(/"Next.js";hit/m)
122122
}
123-
expect(headers2['netlify-cdn-cache-control']).toBe(
123+
expect(headers2['debug-netlify-cdn-cache-control']).toBe(
124124
nextVersionSatisfies('>=15.0.0-canary.187')
125125
? 's-maxage=31536000, durable'
126126
: 's-maxage=31536000, stale-while-revalidate=31536000, durable',
@@ -152,7 +152,7 @@ test.describe('app router on-demand revalidation', () => {
152152
const headers3 = response3?.headers() || {}
153153
expect(response3?.status()).toBe(200)
154154
expect(headers3?.['x-nextjs-cache']).toBeUndefined()
155-
expect(headers3['netlify-cdn-cache-control']).toBe(
155+
expect(headers3['debug-netlify-cdn-cache-control']).toBe(
156156
nextVersionSatisfies('>=15.0.0-canary.187')
157157
? 's-maxage=31536000, durable'
158158
: 's-maxage=31536000, stale-while-revalidate=31536000, durable',
@@ -181,7 +181,7 @@ test.describe('app router on-demand revalidation', () => {
181181
// as we reuse cached response
182182
expect(headers4['cache-status']).toMatch(/"Next.js";hit/m)
183183
}
184-
expect(headers4['netlify-cdn-cache-control']).toBe(
184+
expect(headers4['debug-netlify-cdn-cache-control']).toBe(
185185
nextVersionSatisfies('>=15.0.0-canary.187')
186186
? 's-maxage=31536000, durable'
187187
: 's-maxage=31536000, stale-while-revalidate=31536000, durable',

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /