diff --git a/packages/integrations/node/src/http-server.ts b/packages/integrations/node/src/http-server.ts index 2c58c0da78d5..177c71ed9a87 100644 --- a/packages/integrations/node/src/http-server.ts +++ b/packages/integrations/node/src/http-server.ts @@ -57,10 +57,10 @@ export function createServer( }); stream.on('directory', () => { // On directory find, redirect to the trailing slash - const location = req.url + '/'; - res.statusCode = 301 - res.setHeader('Location', location); - res.end(location); + const location = req.url + '/'; + res.statusCode = 301; + res.setHeader('Location', location); + res.end(location); }); stream.on('file', () => { forwardError = true; diff --git a/packages/integrations/node/test/prerender.test.js b/packages/integrations/node/test/prerender.test.js index 1b478bb33722..0ef316ed65a9 100644 --- a/packages/integrations/node/test/prerender.test.js +++ b/packages/integrations/node/test/prerender.test.js @@ -61,7 +61,7 @@ describe('Prerendering', () => { it('Omitting the trailing slash results in a redirect that includes the base', async () => { const res = await fetch(`http://${server.host}:${server.port}/some-base/two`, { - redirect: 'manual' + redirect: 'manual', }); expect(res.status).to.equal(301); expect(res.headers.get('location')).to.equal('/some-base/two/');