Skip to content

A platform for community discussion. Free, open, simple.

FIX: Already sent headers error in Ember CLI (#12706)

Robin Ward32689573fa7d
diff --git a/app/assets/javascripts/discourse/lib/bootstrap-json/index.js b/app/assets/javascripts/discourse/lib/bootstrap-json/index.js
index 4bd268ca1dd..d2a7b7803a0 100644
--- a/app/assets/javascripts/discourse/lib/bootstrap-json/index.js
+++ b/app/assets/javascripts/discourse/lib/bootstrap-json/index.js
@@ -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();
+ }
}
});
},