DEV: Ensure ember-cli does not attempt to bootstrap non-ember pages (#15168)

1b3d124a introduced a logic change which meant that we attempted to bootstrap, even on pages without any `preloadJson` (i.e. non-ember HTML pages from Discourse). This commit restores the original logic, making sure to avoid `?.`.
This commit is contained in:
David Taylor 2021-12-02 10:58:54 +00:00 committed by GitHub
parent 44d16fcd8e
commit ceca34aca6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -270,9 +270,11 @@ async function handleRequest(proxy, baseURL, req, res) {
}
const contentType = response.headers.get("content-type");
const isHTML = contentType && contentType.startsWith("text/html");
const responseText = await response.text();
const preloadJson = isHTML ? extractPreloadJson(responseText) : null;
if (contentType && contentType.startsWith("text/html")) {
if (preloadJson) {
const html = await buildFromBootstrap(
proxy,
baseURL,