From ae8fab32a4c3c40564b710febea3c005d061a473 Mon Sep 17 00:00:00 2001 From: Philippe Serhal Date: Wed, 26 Feb 2025 12:48:13 -0500 Subject: [PATCH] fix: expect renamed debug headers --- edge-runtime/lib/response.ts | 4 +++- tests/utils/fixture.ts | 14 +++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/edge-runtime/lib/response.ts b/edge-runtime/lib/response.ts index ec0730e8c..8e0989b3f 100644 --- a/edge-runtime/lib/response.ts +++ b/edge-runtime/lib/response.ts @@ -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 diff --git a/tests/utils/fixture.ts b/tests/utils/fixture.ts index 59e8b7b09..16961e66d 100644 --- a/tests/utils/fixture.ts +++ b/tests/utils/fixture.ts @@ -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, },