Merge pull request 'fix(server): respond to HEAD / so health checks return 200' (#2) from fix/head-method into main

This commit was merged in pull request #2.
This commit is contained in:
2026-07-09 17:55:05 +02:00
+2 -2
View File
@@ -193,10 +193,10 @@ const server = createServer(async (req, res) => {
const { id, session } = getSession(req.headers["cookie"]); const { id, session } = getSession(req.headers["cookie"]);
const url = req.url.split("?")[0]; const url = req.url.split("?")[0];
if (req.method === "GET" && url === "/") { if ((req.method === "GET" || req.method === "HEAD") && url === "/") {
setCookie(res, id); setCookie(res, id);
res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" }); res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
res.end(renderPage(session, "", null)); res.end(req.method === "HEAD" ? "" : renderPage(session, "", null));
return; return;
} }