8000 fix: fix e2e static regeneration test code (#2398) · doctify/serverless-next.js@e13e821 · GitHub
[go: up one dir, main page]

Skip to content

Commit e13e821

Browse files
fix: fix e2e static regeneration test code (serverless-nextjs#2398)
1 parent 416adf1 commit e13e821

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

packages/e2e-tests/next-app-with-locales/cypress/integration/static-regeneration.test.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,19 @@ describe("ISR Tests", () => {
55
describe("SSG Redirect", () => {
66
it("non existing user redirects to home", () => {
77
const path = "/en/revalidated-ssg-pages/106";
8-
cy.ensureRouteHasStatusCode(path, 307);
8+
cy.request({ url: path }).then((response) => {
9+
expect(response.status).to.equal(200);
910

10-
const redirectedPath = "/";
11-
12-
// Verify redirect response
13-
cy.verifyRedirect(path, redirectedPath, 307);
11+
const redirectedPath = "/";
12+
// Verify redirect response
13+
expect(response.body).to.deep.equal({
14+
pageProps: {
15+
__N_REDIRECT: redirectedPath,
16+
__N_REDIRECT_STATUS: 307
17+
},
18+
__N_SSG: true
19+
});
20+
});
1421
});
1522
});
1623
describe("SSG page", () => {

packages/libs/core/src/handle/redirect.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export const redirectByPageProps = (event: Event, route: RedirectRoute) => {
1313
"cache-control",
1414
route.headers?.cacheControl?.join(":") ?? ""
1515
);
16+
event.res.setHeader("Content-Type", "application/json");
1617
event.res.statusCode = 200;
1718

1819
const body = {

0 commit comments

Comments
 (0)
0