diff --git a/packages/server/src/middleware/nuxt.js b/packages/server/src/middleware/nuxt.js
index 5d1b42333f..8908301d37 100644
--- a/packages/server/src/middleware/nuxt.js
+++ b/packages/server/src/middleware/nuxt.js
@@ -7,11 +7,12 @@ import { getContext } from '@nuxt/common'
export default ({ options, nuxt, renderRoute, resources }) => async function nuxtMiddleware(req, res, next) {
// Get context
const context = getContext(req, res)
+ const url = req.url
res.statusCode = 200
try {
- const result = await renderRoute(req.url, context)
- await nuxt.callHook('render:route', req.url, result, context)
+ const result = await renderRoute(url, context)
+ await nuxt.callHook('render:route', url, result, context)
const {
html,
cspScriptSrcHashSet,
@@ -21,7 +22,7 @@ export default ({ options, nuxt, renderRoute, resources }) => async function nux
} = result
if (redirected) {
- nuxt.callHook('render:routeDone', req.url, result, context)
+ nuxt.callHook('render:routeDone', url, result, context)
return html
}
if (error) {
@@ -34,7 +35,7 @@ export default ({ options, nuxt, renderRoute, resources }) => async function nux
if (fresh(req.headers, { etag })) {
res.statusCode = 304
res.end()
- nuxt.callHook('render:routeDone', req.url, result, context)
+ nuxt.callHook('render:routeDone', url, result, context)
return
}
res.setHeader('ETag', etag)
@@ -73,7 +74,7 @@ export default ({ options, nuxt, renderRoute, resources }) => async function nux
res.setHeader('Accept-Ranges', 'none') // #3870
res.setHeader('Content-Length', Buffer.byteLength(html))
res.end(html, 'utf8')
- nuxt.callHook('render:routeDone', req.url, result, context)
+ nuxt.callHook('render:routeDone', url, result, context)
return html
} catch (err) {
/* istanbul ignore if */
diff --git a/packages/vue-app/package.json b/packages/vue-app/package.json
index 84e1762ce4..3b807b28de 100644
--- a/packages/vue-app/package.json
+++ b/packages/vue-app/package.json
@@ -8,6 +8,7 @@
"template"
],
"main": "dist/vue-app.js",
+ "typings": "types/index.d.ts",
"publishConfig": {
"access": "public"
},
diff --git a/packages/vue-app/template/utils.js b/packages/vue-app/template/utils.js
index 91afe358cc..066400915c 100644
--- a/packages/vue-app/template/utils.js
+++ b/packages/vue-app/template/utils.js
@@ -242,7 +242,7 @@ export function getLocation(base, mode) {
if (base && path.indexOf(base) === 0) {
path = path.slice(base.length)
}
- return (path || '/') + window.location.search + window.location.hash
+ return decodeURI(path || '/') + window.location.search + window.location.hash
}
export function urlJoin() {
diff --git a/test/fixtures/basic/nuxt.config.js b/test/fixtures/basic/nuxt.config.js
index cc38d9f604..0e6f38f8a7 100644
--- a/test/fixtures/basic/nuxt.config.js
+++ b/test/fixtures/basic/nuxt.config.js
@@ -31,6 +31,7 @@ export default {
'/store-module',
'/users/1',
'/users/2',
+ '/тест雨',
{ route: '/users/3', payload: { id: 3000 } }
],
interval: 200,
diff --git a/test/fixtures/basic/pages/тест雨.vue b/test/fixtures/basic/pages/тест雨.vue
new file mode 100644
index 0000000000..b7953cf6c7
--- /dev/null
+++ b/test/fixtures/basic/pages/тест雨.vue
@@ -0,0 +1,3 @@
+
+
Nuxt.js
') }) + test('/тест雨 (test non ascii route)', async () => { + const window = await generator.nuxt.server.renderAndGetWindow(url('/тест雨')) + const html = window.document.body.innerHTML + expect(html).toContain('Hello unicode') + }) + test('/users/1/index.html', async () => { const html = await rp(url('/users/1/index.html')) expect(html).toContain('