Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update x-nextjs-cache header in minimal mode #36791

Merged
merged 1 commit into from May 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/next/server/base-server.ts
Expand Up @@ -1629,7 +1629,7 @@ export default abstract class Server<ServerOptions extends Options = Options> {
return null
}

if (isSSG) {
if (isSSG && !this.minimalMode) {
// set x-nextjs-cache header to match the header
// we set for the image-optimizer
res.setHeader(
Expand Down
2 changes: 2 additions & 0 deletions test/production/required-server-files.test.ts
Expand Up @@ -188,6 +188,7 @@ describe('should set-up next', () => {
redirect: 'manual',
})
expect(res.status).toBe(200)
expect(res.headers.get('x-nextjs-cache')).toBeFalsy()
const $ = cheerio.load(await res.text())
const props = JSON.parse($('#props').text())
expect(props.gspCalls).toBeDefined()
Expand All @@ -201,6 +202,7 @@ describe('should set-up next', () => {
}
)
expect(res2.status).toBe(200)
expect(res2.headers.get('x-nextjs-cache')).toBeFalsy()
const { pageProps: props2 } = await res2.json()
expect(props2.gspCalls).toBe(props.gspCalls)

Expand Down