Unverified Commit 997e3c0c authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Ensure locale redirects are not applied in minimal mode (#39436)

parent ed14af30
...@@ -617,7 +617,7 @@ export default abstract class Server<ServerOptions extends Options = Options> { ...@@ -617,7 +617,7 @@ export default abstract class Server<ServerOptions extends Options = Options> {
} }
} }
if (defaultLocale) { if (!this.minimalMode && defaultLocale) {
const redirect = getLocaleRedirect({ const redirect = getLocaleRedirect({
defaultLocale, defaultLocale,
domainLocale, domainLocale,
......
...@@ -135,6 +135,27 @@ describe('should set-up next', () => { ...@@ -135,6 +135,27 @@ describe('should set-up next', () => {
if (server) await killApp(server) if (server) await killApp(server)
}) })
it('should not apply locale redirect in minimal mode', async () => {
const res = await fetchViaHTTP(appPort, '/', undefined, {
redirect: 'manual',
headers: {
'accept-language': 'fr',
},
})
expect(res.status).toBe(200)
expect(await res.text()).toContain('index page')
const resCookie = await fetchViaHTTP(appPort, '/', undefined, {
redirect: 'manual',
headers: {
'accept-language': 'en',
cookie: 'NEXT_LOCALE=fr',
},
})
expect(resCookie.status).toBe(200)
expect(await resCookie.text()).toContain('index page')
})
it('should output required-server-files manifest correctly', async () => { it('should output required-server-files manifest correctly', async () => {
expect(requiredFilesManifest.version).toBe(1) expect(requiredFilesManifest.version).toBe(1)
expect(Array.isArray(requiredFilesManifest.files)).toBe(true) expect(Array.isArray(requiredFilesManifest.files)).toBe(true)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment