« get me outta code hell

write: live-dev-server: always send content-length from web routes - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-05-15 21:14:56 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-05-15 21:14:56 -0300
commitaeb8c1d4aa11ced91d4228541cd340530c8452f5 (patch)
treeb8dbaf57342634c39f7c276f5bb27fd533d2aae8
parentf50792513c5f8f8b8c48c0064ccb3894b38479b0 (diff)
write: live-dev-server: always send content-length from web routes
-rw-r--r--src/write/build-modes/live-dev-server.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/write/build-modes/live-dev-server.js b/src/write/build-modes/live-dev-server.js
index 91ed4ee3..cb878337 100644
--- a/src/write/build-modes/live-dev-server.js
+++ b/src/write/build-modes/live-dev-server.js
@@ -302,10 +302,10 @@ export async function go({
       try {
         const {size} = await stat(filePath);
         const buffer = await readFile(filePath)
-        response.writeHead(200, contentType ? {
-          'Content-Type': contentType,
+        response.writeHead(200, {
+          ...contentType ? {'Content-Type': contentType} : {},
           'Content-Length': size,
-        } : {});
+        });
         response.end(buffer);
         if (loudResponses) console.log(`${requestHead} [200] ${pathname}`);
       } catch (error) {