mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 15:15:19 +00:00
fix(nuxt): don't encode location header (#26893)
This commit is contained in:
parent
64d09fa31d
commit
62296818aa
@ -169,7 +169,8 @@ export const navigateTo = (to: RouteLocationRaw | undefined | null, options?: Na
|
|||||||
nuxtApp.ssrContext!._renderResponse = {
|
nuxtApp.ssrContext!._renderResponse = {
|
||||||
statusCode: sanitizeStatusCode(options?.redirectCode || 302, 302),
|
statusCode: sanitizeStatusCode(options?.redirectCode || 302, 302),
|
||||||
body: `<!DOCTYPE html><html><head><meta http-equiv="refresh" content="0; url=${encodedLoc}"></head></html>`,
|
body: `<!DOCTYPE html><html><head><meta http-equiv="refresh" content="0; url=${encodedLoc}"></head></html>`,
|
||||||
headers: { location: encodeURI(location) },
|
// do not encode as this would break some modules and some environments
|
||||||
|
headers: { location },
|
||||||
}
|
}
|
||||||
return response
|
return response
|
||||||
}
|
}
|
||||||
|
@ -937,12 +937,6 @@ describe('navigate', () => {
|
|||||||
|
|
||||||
expect(status).toEqual(404)
|
expect(status).toEqual(404)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('expect to redirect with encoding', async () => {
|
|
||||||
const { status } = await fetch('/redirect-with-encode', { redirect: 'manual' })
|
|
||||||
|
|
||||||
expect(status).toEqual(302)
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('preserves current instance', () => {
|
describe('preserves current instance', () => {
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
oh no !
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
await navigateTo('/cœur')
|
|
||||||
</script>
|
|
Loading…
Reference in New Issue
Block a user