This repository was archived by the owner on Jun 21, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +3
-6
lines changed
test/integration/client-navigation/test Expand file tree Collapse file tree 3 files changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -1447,7 +1447,6 @@ export default class Server {
14471447 ) : Promise < string | null > {
14481448 const is404Page = pathname === '/404'
14491449 const is500Page = pathname === '/500'
1450- const isErrorPage = pathname === '/_error'
14511450
14521451 const isLikeServerless =
14531452 typeof components . Component === 'object' &&
@@ -1466,10 +1465,6 @@ export default class Server {
14661465 res . statusCode = 404
14671466 }
14681467
1469- if ( isErrorPage && res . statusCode === 200 ) {
1470- res . statusCode = 404
1471- }
1472-
14731468 // ensure correct status is set when visiting a status page
14741469 // directly e.g. /500
14751470 if ( STATIC_STATUS_PAGES . includes ( pathname ) ) {
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ export const SERVER_DIRECTORY = 'server'
1717export const SERVERLESS_DIRECTORY = 'serverless'
1818export const CONFIG_FILE = 'next.config.js'
1919export const BUILD_ID_FILE = 'BUILD_ID'
20- export const BLOCKED_PAGES = [ '/_document' , '/_app' ]
20+ export const BLOCKED_PAGES = [ '/_document' , '/_app' , '/_error' ]
2121export const CLIENT_PUBLIC_FILES_PATH = 'public'
2222export const CLIENT_STATIC_FILES_PATH = 'static'
2323export const CLIENT_STATIC_FILES_RUNTIME = 'runtime'
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ describe('Client Navigation', () => {
2929 afterAll ( ( ) => killApp ( context . server ) )
3030
3131 it ( 'should not reload when visiting /_error directly' , async ( ) => {
32+ const { status } = await fetchViaHTTP ( context . appPort , '/_error' )
3233 const browser = await webdriver ( context . appPort , '/_error' )
3334
3435 await browser . eval ( 'window.hello = true' )
@@ -41,6 +42,7 @@ describe('Client Navigation', () => {
4142 }
4243 const html = await browser . eval ( 'document.documentElement.innerHTML' )
4344
45+ expect ( status ) . toBe ( 404 )
4446 expect ( html ) . toContain ( 'This page could not be found' )
4547 expect ( html ) . toContain ( '404' )
4648 } )
You can’t perform that action at this time.
0 commit comments