Skip to content

Commit

Permalink
fix: expect renamed debug headers
Browse files Browse the repository at this point in the history
  • Loading branch information
serhalp committed Feb 26, 2025
1 parent f3e24b1 commit ae8fab3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 3 additions & 1 deletion edge-runtime/lib/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@ export const buildResponse = async ({

// Remove Netlify internal headers
const headers = new Headers(
[...request.headers.entries()].filter(([key]) => !key.startsWith('x-nf-')),
[...request.headers.entries()].filter(
([key]) => !key.startsWith('x-nf-') && !key.startsWith('debug-x-nf-'),
),
)
if (request.body && !request.bodyUsed) {
// This is not ideal, but streaming to an external URL doesn't work
Expand Down
14 changes: 7 additions & 7 deletions tests/utils/fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -473,17 +473,17 @@ export async function invokeEdgeFunction(

// Checkout the stargate headers: https://github.com/netlify/stargate/blob/dc8adfb6e91fa0a2fb00c0cba06e4e2f9e5d4e4d/proxy/deno/edge.go#L1142-L1170
headers: {
'x-nf-edge-functions': functionsToInvoke.join(','),
'x-nf-deploy-id': ctx.deployID,
'x-nf-site-info': Buffer.from(
'debug-x-nf-edge-functions': functionsToInvoke.join(','),
'debug-x-nf-deploy-id': ctx.deployID,
'debug-x-nf-site-info': Buffer.from(
JSON.stringify({ id: ctx.siteID, name: 'Test Site', url: 'https://example.com' }),
).toString('base64'),
'x-nf-blobs-info': Buffer.from(
'debug-x-nf-blobs-info': Buffer.from(
JSON.stringify({ url: `http://${ctx.blobStoreHost}`, token: BLOB_TOKEN }),
).toString('base64'),
'x-nf-passthrough': 'passthrough',
'x-nf-passthrough-host': passthroughHost,
'x-nf-passthrough-proto': 'http:',
'debug-x-nf-passthrough': 'passthrough',
'debug-x-nf-passthrough-host': passthroughHost,
'debug-x-nf-passthrough-proto': 'http:',
'x-nf-request-id': v4(),
...options.headers,
},
Expand Down

0 comments on commit ae8fab3

Please sign in to comment.