Skip to content

Commit 9b9fdc6

Browse files
authored
fix: expect renamed debug response headers (#33)
1 parent 363f70f commit 9b9fdc6

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

app/utils/getCacheAnalysis.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,10 @@ const getServedBySource = (
126126

127127
// NOTE: the order is important here, since a response can be served by a Function even
128128
// though one or more Edge Functions are also invoked (as middleware).
129-
if (cacheHeaders.has('X-NF-Function-Type')) return ServedBySource.Function
129+
if (cacheHeaders.has('Debug-X-NF-Function-Type'))
130+
return ServedBySource.Function
130131

131-
if (cacheHeaders.has('X-NF-Edge-Functions'))
132+
if (cacheHeaders.has('Debug-X-NF-Edge-Functions'))
132133
return ServedBySource.EdgeFunction
133134

134135
throw new Error(

app/utils/getCacheHeaders.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@ const CACHE_HEADER_NAMES = [
1313
'Netlify-Cache-Tag',
1414
'Netlify-Vary',
1515
'Vary',
16-
'X-BB-Deploy-Id',
17-
'X-BB-Gen',
18-
'X-BB-Host-Id',
19-
'X-NF-Cache-Key',
20-
'X-NF-Cache-Info',
21-
'X-NF-Cache-Result',
22-
'X-NF-Durable-Cache-Result',
16+
'Debug-X-BB-Deploy-Id',
17+
'Debug-X-BB-Gen',
18+
'Debug-X-BB-Host-Id',
19+
'Debug-X-NF-Cache-Key',
20+
'Debug-X-NF-Cache-Info',
21+
'Debug-X-NF-Cache-Result',
22+
'Debug-X-NF-Durable-Cache-Result',
2323
// TODO(serhalp) These two probably shouldn't be here but I use it to determine who served the
2424
// request. Need to refactor to pass the whole headers obj to `getServedBy` to remove this.
25-
'X-NF-Edge-Functions',
26-
'X-NF-Function-Type',
27-
'X-NF-Request-Id',
25+
'Debug-X-NF-Edge-Functions',
26+
'Debug-X-NF-Function-Type',
27+
'Debug-X-NF-Request-Id',
2828
'X-Nextjs-Cache',
2929
'X-Nextjs-Date',
3030
]

0 commit comments

Comments
 (0)