mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-03 02:47:12 +00:00
adding more robust handling for middleware headerSent
This commit is contained in:
parent
95c149f76b
commit
6a34d9a05a
@ -98,7 +98,7 @@ export default async (context) => {
|
||||
if (!context.nuxt.error) {
|
||||
await middlewareSeries(midd, ctx)
|
||||
}
|
||||
if (context.res.headersSent) return
|
||||
if (context.res && context.res.headersSent) return
|
||||
if (context.redirected) return _noopApp
|
||||
// Set layout
|
||||
let layout = Components.length ? Components[0].options.layout : NuxtError.layout
|
||||
|
@ -104,7 +104,7 @@ export function middlewareSeries (promises, context) {
|
||||
}
|
||||
return promisify(promises[0], context)
|
||||
.then(() => {
|
||||
if (context.res.headersSent) return
|
||||
if (context.res && context.res.headersSent) return
|
||||
return middlewareSeries(promises.slice(1), context)
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user