« get me outta code hell

build: live-dev-server: don't writeHead until content is ready - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/write
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-06-02 09:22:01 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-06-02 09:22:01 -0300
commitd646ae0de00aebefb15faedfbdfe9995e2250b17 (patch)
treee9760af727beaa2147a8481c94f277dc65ccc1d2 /src/write
parentd46263754923e99ada6a9b368929a1f7c9b78f7f (diff)
build: live-dev-server: don't writeHead until content is ready
Cherry-picked from 63be025
Diffstat (limited to 'src/write')
-rw-r--r--src/write/build-modes/live-dev-server.js15
1 files changed, 1 insertions, 14 deletions
diff --git a/src/write/build-modes/live-dev-server.js b/src/write/build-modes/live-dev-server.js
index 3cd3ed6b..10b40cf0 100644
--- a/src/write/build-modes/live-dev-server.js
+++ b/src/write/build-modes/live-dev-server.js
@@ -330,8 +330,6 @@ export async function go({
         return;
       }
 
-      response.writeHead(200, contentTypeHTML);
-
       const localizedPathnames = getPagePathnameAcrossLanguages({
         defaultLanguage,
         languages,
@@ -464,19 +462,8 @@ export async function go({
 
       const pageHTML = topLevelResult.toString();
 
-      /*
-      const pageHTML = generateDocumentHTML(pageInfo, {
-        ...bound,
-        cachebust,
-        developersComment,
-        localizedPathnames,
-        oEmbedJSONHref: null, // No oEmbed support for live dev server
-        pagePath: servePath,
-        pathname,
-      });
-      */
-
       console.log(`${requestHead} [200] ${pathname}`);
+      response.writeHead(200, contentTypeHTML);
       response.end(pageHTML);
     } catch (error) {
       response.writeHead(500, contentTypePlain);