diff --git a/packages/e2e-tests/next-app-with-locales/cypress/integration/static-regeneration.test.ts b/packages/e2e-tests/next-app-with-locales/cypress/integration/static-regeneration.test.ts index c33f7b9ce9..2e73bb2277 100644 --- a/packages/e2e-tests/next-app-with-locales/cypress/integration/static-regeneration.test.ts +++ b/packages/e2e-tests/next-app-with-locales/cypress/integration/static-regeneration.test.ts @@ -5,12 +5,19 @@ describe("ISR Tests", () => { describe("SSG Redirect", () => { it("non existing user redirects to home", () => { const path = "/en/revalidated-ssg-pages/106"; - cy.ensureRouteHasStatusCode(path, 307); + cy.request({ url: path }).then((response) => { + expect(response.status).to.equal(200); - const redirectedPath = "/"; - - // Verify redirect response - cy.verifyRedirect(path, redirectedPath, 307); + const redirectedPath = "/"; + // Verify redirect response + expect(response.body).to.deep.equal({ + pageProps: { + __N_REDIRECT: redirectedPath, + __N_REDIRECT_STATUS: 307 + }, + __N_SSG: true + }); + }); }); }); describe("SSG page", () => { diff --git a/packages/libs/core/src/handle/redirect.ts b/packages/libs/core/src/handle/redirect.ts index 0a8f1aae63..ceb323330d 100644 --- a/packages/libs/core/src/handle/redirect.ts +++ b/packages/libs/core/src/handle/redirect.ts @@ -13,6 +13,7 @@ export const redirectByPageProps = (event: Event, route: RedirectRoute) => { "cache-control", route.headers?.cacheControl?.join(":") ?? "" ); + event.res.setHeader("Content-Type", "application/json"); event.res.statusCode = 200; const body = {