Files
Jiachi LiuandGitHub 93aac0e39b Respect non 200 status to page static generation response (#63731)
### What

In static generation phase of app page, if there's any case that we're
receiving 3xx/4xx status code from the response, we 're setting it into
the static generation meta now to make sure they're still returning the
same status after build.

### Why

During static generation if there's any 3xx/4xx status code that is set
in the response, we should respect to it, such as the ones caused by
using `notFound()` to mark as 404 response or `redirect` to mark as
`307` response.

Closes NEXT-2895
Fixes #51021
Fixes #62228
2024-03-27 16:20:02 +01:00

27 lines
868 B
TypeScript

import { createNextDescribe } from 'e2e-utils'
createNextDescribe(
'app-dir parallel-routes-static',
{
files: __dirname,
},
({ next }) => {
it('should static generate parallel routes', async () => {
const rscExtension = process.env.__NEXT_EXPERIMENTAL_PPR
? '.prefetch.rsc'
: '.rsc'
expect(await next.hasFile('.next/server/app/nested/foo.html')).toBe(true)
expect(await next.hasFile('.next/server/app/nested/foo.meta')).toBe(true)
expect(
await next.hasFile(`.next/server/app/nested/foo${rscExtension}`)
).toBe(true)
expect(await next.hasFile('.next/server/app/nested/bar.html')).toBe(true)
expect(await next.hasFile('.next/server/app/nested/bar.meta')).toBe(true)
expect(
await next.hasFile(`.next/server/app/nested/bar${rscExtension}`)
).toBe(true)
})
}
)