mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-03 02:47:12 +00:00
adding ability to send res with middleware
This commit is contained in:
parent
e5906e5ac4
commit
95c149f76b
@ -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
|
||||
|
@ -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)
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user