mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-29 17:07:22 +00:00
fix(nuxt3,bridge): rename error handler url (#4215)
This commit is contained in:
parent
f2fc135721
commit
edd0b30896
@ -228,7 +228,7 @@ export async function setupNitroBridge () {
|
|||||||
nitro.options.handlers.push(...handlers)
|
nitro.options.handlers.push(...handlers)
|
||||||
nitro.options.devHandlers.push(...devHandlers)
|
nitro.options.devHandlers.push(...devHandlers)
|
||||||
nitro.options.handlers.unshift({
|
nitro.options.handlers.unshift({
|
||||||
route: '/_nitro',
|
route: '/__nuxt_error',
|
||||||
lazy: true,
|
lazy: true,
|
||||||
handler: resolve(distDir, 'runtime/nitro/renderer')
|
handler: resolve(distDir, 'runtime/nitro/renderer')
|
||||||
})
|
})
|
||||||
|
@ -128,7 +128,7 @@ export async function initNitro (nuxt: Nuxt) {
|
|||||||
nitro.options.handlers.push(...handlers)
|
nitro.options.handlers.push(...handlers)
|
||||||
nitro.options.devHandlers.push(...devHandlers)
|
nitro.options.devHandlers.push(...devHandlers)
|
||||||
nitro.options.handlers.unshift({
|
nitro.options.handlers.unshift({
|
||||||
route: '/_nitro',
|
route: '/__nuxt_error',
|
||||||
lazy: true,
|
lazy: true,
|
||||||
handler: resolve(distDir, 'core/runtime/nitro/renderer')
|
handler: resolve(distDir, 'core/runtime/nitro/renderer')
|
||||||
})
|
})
|
||||||
|
@ -29,7 +29,7 @@ export default async function handleError (error: any, event: CompatibilityEvent
|
|||||||
}
|
}
|
||||||
|
|
||||||
// HTML response
|
// HTML response
|
||||||
const url = withQuery('/_nitro/__error', errorObject as any)
|
const url = withQuery('/__nuxt_error', errorObject as any)
|
||||||
const html = await $fetch(url).catch(() => errorObject.statusMessage)
|
const html = await $fetch(url).catch(() => errorObject.statusMessage)
|
||||||
|
|
||||||
event.res.setHeader('Content-Type', 'text/html;charset=UTF-8')
|
event.res.setHeader('Content-Type', 'text/html;charset=UTF-8')
|
||||||
|
@ -73,7 +73,7 @@ function renderToString (ssrContext) {
|
|||||||
|
|
||||||
export default eventHandler(async (event) => {
|
export default eventHandler(async (event) => {
|
||||||
// Whether we're rendering an error page
|
// Whether we're rendering an error page
|
||||||
const ssrError = event.req.url?.startsWith('/__error') ? useQuery(event) : null
|
const ssrError = event.req.url?.startsWith('/__nuxt_error') ? useQuery(event) : null
|
||||||
let url = ssrError?.url as string || event.req.url!
|
let url = ssrError?.url as string || event.req.url!
|
||||||
|
|
||||||
// payload.json request detection
|
// payload.json request detection
|
||||||
|
Loading…
Reference in New Issue
Block a user