adding ability to send res with middleware

This commit is contained in:
Nick Galloway 2017-07-07 12:59:29 -05:00
parent e5906e5ac4
commit 95c149f76b
2 changed files with 2 additions and 0 deletions

View File

@ -98,6 +98,7 @@ export default async (context) => {
if (!context.nuxt.error) {
await middlewareSeries(midd, ctx)
}
if (context.res.headersSent) return
if (context.redirected) return _noopApp
// Set layout
let layout = Components.length ? Components[0].options.layout : NuxtError.layout

View File

@ -104,6 +104,7 @@ export function middlewareSeries (promises, context) {
}
return promisify(promises[0], context)
.then(() => {
if (context.res.headersSent) return
return middlewareSeries(promises.slice(1), context)
})
}