From c3128eacedf442f3f506d451f5b78464943983b6 Mon Sep 17 00:00:00 2001 From: Dmitry Molotkov Date: Mon, 10 Dec 2018 19:48:23 +0300 Subject: [PATCH] fix(server): allow rendering urls with unicode characters (#4512) --- packages/server/src/middleware/nuxt.js | 2 +- test/unit/basic.ssr.test.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/server/src/middleware/nuxt.js b/packages/server/src/middleware/nuxt.js index 628e234fb8..a743222aba 100644 --- a/packages/server/src/middleware/nuxt.js +++ b/packages/server/src/middleware/nuxt.js @@ -7,7 +7,7 @@ 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 + const url = decodeURI(req.url) res.statusCode = 200 try { diff --git a/test/unit/basic.ssr.test.js b/test/unit/basic.ssr.test.js index cad81ab9a4..a04f74643e 100644 --- a/test/unit/basic.ssr.test.js +++ b/test/unit/basic.ssr.test.js @@ -324,7 +324,8 @@ describe('basic ssr', () => { }) test('/тест雨 (test non ascii route)', async () => { - const { html } = await nuxt.server.renderRoute('/тест雨') + const window = await nuxt.server.renderAndGetWindow(url('/тест雨')) + const html = window.document.body.innerHTML expect(html).toMatch('Hello unicode') })