diff --git a/src/lib/functions/server.mjs b/src/lib/functions/server.mjs index 07e88104611..5f5f7f8abd3 100644 --- a/src/lib/functions/server.mjs +++ b/src/lib/functions/server.mjs @@ -233,10 +233,6 @@ const getFunctionsServer = (options) => { }), ) - app.get('/favicon.ico', function onRequest(_req, res) { - res.status(204).end() - }) - app.all(`${functionsPrefix}*`, functionHandler) app.all(`${buildersPrefix}*`, functionHandler) diff --git a/tests/integration/__fixtures__/dev-server-with-v2-functions/functions/favicon.mjs b/tests/integration/__fixtures__/dev-server-with-v2-functions/functions/favicon.mjs new file mode 100644 index 00000000000..9718d3d5dc0 --- /dev/null +++ b/tests/integration/__fixtures__/dev-server-with-v2-functions/functions/favicon.mjs @@ -0,0 +1,6 @@ +export default () => new Response(`custom-generated favicon`) + +export const config = { + path: '/favicon.ico', + method: 'GET', +} diff --git a/tests/integration/commands/dev/v2-api.test.ts b/tests/integration/commands/dev/v2-api.test.ts index 1814f6887b0..012a9dd7fdf 100644 --- a/tests/integration/commands/dev/v2-api.test.ts +++ b/tests/integration/commands/dev/v2-api.test.ts @@ -152,6 +152,12 @@ describe.runIf(gte(version, '18.13.0'))('v2 api', () => { expect(await response.text()).toBe(`Catchall Path`) }) + test('functions can also run on /favicon.ico', async ({ devServer }) => { + const response = await fetch(`http://localhost:${devServer.port}/favicon.ico`) + expect(response.status).toBe(200) + expect(await response.text()).toBe('custom-generated favicon') + }) + test('returns 404 when using the default function URL to access a function with custom routes', async ({ devServer, }) => {