-
-
Notifications
You must be signed in to change notification settings - Fork 488
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix:
statusCode
in rootRedirect
not working with strategy 'prefix' (
- Loading branch information
1 parent
06b4e25
commit 933a092
Showing
8 changed files
with
72 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<script setup lang="ts"></script> | ||
|
||
<template> | ||
<div> | ||
<NuxtPage /> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// https://nuxt.com/docs/guide/directory-structure/nuxt.config | ||
export default defineNuxtConfig({ | ||
modules: ['@nuxtjs/i18n'], | ||
debug: false, | ||
i18n: { | ||
defaultLocale: 'en', | ||
strategy: 'prefix', | ||
rootRedirect: { | ||
statusCode: 418, | ||
path: 'test-route' | ||
}, | ||
locales: [ | ||
{ | ||
code: 'en', | ||
iso: 'en-US' | ||
}, | ||
{ | ||
code: 'fr', | ||
iso: 'fr-FR' | ||
} | ||
] | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "nuxt3-test-basic-usage-layers", | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
"dev": "nuxi dev", | ||
"build": "nuxt build", | ||
"start": "node .output/server/index.mjs" | ||
}, | ||
"devDependencies": { | ||
"@nuxtjs/i18n": "latest", | ||
"nuxt": "latest" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<h1>Home</h1> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<div>Test route</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { test, expect, describe } from 'vitest' | ||
import { fileURLToPath } from 'node:url' | ||
import { setup, fetch, url } from '../utils' | ||
|
||
describe('#2758', async () => { | ||
await setup({ | ||
rootDir: fileURLToPath(new URL(`../fixtures/issues/2758`, import.meta.url)) | ||
}) | ||
|
||
test('`statusCode` in `rootRedirect` should work with strategy "prefix"', async () => { | ||
const res = await fetch(url('/')) | ||
expect(res.status).toEqual(418) | ||
expect(res.headers.get('location')).toEqual('/en/test-route') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters