FIX: Already sent headers error in Ember CLI (#12706)
If we are sending a custom template, we shouldn't do a `next()`, we should halt middleware.
This commit is contained in:
parent
e459937ffa
commit
32689573fa
|
@ -180,6 +180,7 @@ module.exports = {
|
|||
: cleanBaseURL(options.rootURL || options.baseURL);
|
||||
|
||||
app.use(async (req, res, next) => {
|
||||
let sentTemplate = false;
|
||||
try {
|
||||
const results = await watcher;
|
||||
if (this.shouldHandleRequest(req, options)) {
|
||||
|
@ -210,11 +211,14 @@ module.exports = {
|
|||
</html>
|
||||
`;
|
||||
}
|
||||
sentTemplate = true;
|
||||
return res.send(template);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
next();
|
||||
if (!sentTemplate) {
|
||||
return next();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue