diff --git a/packages/cli/src/util/extension/proxy.ts b/packages/cli/src/util/extension/proxy.ts index dc9c6fcec7d..fe71fc2f29c 100644 --- a/packages/cli/src/util/extension/proxy.ts +++ b/packages/cli/src/util/extension/proxy.ts @@ -8,10 +8,7 @@ import { import type { Server } from 'http'; import type Client from '../client'; -const toHeaders = buildToHeaders({ - // @ts-expect-error - `node-fetch` Headers is missing `getAll()` - Headers, -}); +const toHeaders = buildToHeaders({ Headers }); export function createProxy(client: Client): Server { return createServer(async (req, res) => { diff --git a/packages/node/test/unit/dev.test.ts b/packages/node/test/unit/dev.test.ts index 2759b82670d..0fd1e4fe72d 100644 --- a/packages/node/test/unit/dev.test.ts +++ b/packages/node/test/unit/dev.test.ts @@ -82,9 +82,8 @@ test('runs an edge function that uses `buffer`', async () => { throw new Error('Exited. error: ' + JSON.stringify(result.value)); } - const response = await fetch( - `http://localhost:${result.value.port}/api/edge-buffer` - ); + const { address, port } = result.value; + const response = await fetch(`http://${address}:${port}/api/edge-buffer`); expect({ status: response.status, json: await response.json(), @@ -109,9 +108,8 @@ test('runs a mjs endpoint', async () => { throw new Error('Exited. error: ' + JSON.stringify(result.value)); } - const response = await fetch( - `http://localhost:${result.value.port}/api/hello` - ); + const { address, port } = result.value; + const response = await fetch(`http://${address}:${port}/api/hello`); expect({ status: response.status, headers: Object.fromEntries(response.headers), @@ -142,9 +140,8 @@ test('runs a esm typescript endpoint', async () => { throw new Error('Exited. error: ' + JSON.stringify(result.value)); } - const response = await fetch( - `http://localhost:${result.value.port}/api/hello` - ); + const { address, port } = result.value; + const response = await fetch(`http://${address}:${port}/api/hello`); expect({ status: response.status, headers: Object.fromEntries(response.headers), @@ -175,9 +172,8 @@ test('allow setting multiple cookies with same name', async () => { throw new Error(`Exited. error: ${JSON.stringify(result.value)}`); } - const response = await fetch( - `http://localhost:${result.value.port}/api/hello` - ); + const { address, port } = result.value; + const response = await fetch(`http://${address}:${port}/api/hello`); expect({ status: response.status, text: await response.text(),