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:
Robin Ward
2021-04-14 15:25:49 -04:00
committed by GitHub
parent e459937ffa
commit 32689573fa

View File

@@ -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();
}
}
});
},