Skip to content

Commit

Permalink
Fix default static /500 with i18n (#29250)
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk authored Sep 21, 2021
1 parent d5b1d59 commit b4d8aa8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/next/export/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export default async function exportPage({
...headerMocks,
} as unknown as ServerResponse

if (path === '/500' && page === '/_error') {
if (updatedPath === '/500' && page === '/_error') {
res.statusCode = 500
}

Expand Down
11 changes: 11 additions & 0 deletions test/integration/i18n-support/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,17 @@ describe('i18n Support', () => {
})

runTests(ctx)

it('should have pre-rendered /500 correctly', async () => {
for (const locale of locales) {
const content = await fs.readFile(
join(appDir, '.next/server/pages/', locale, '500.html'),
'utf8'
)
expect(content).toContain('500')
expect(content).toMatch(/internal server error/i)
}
})
})

describe('serverless mode', () => {
Expand Down

0 comments on commit b4d8aa8

Please sign in to comment.