Responder a HEAD / con 200 (curl -I y monitores)

This commit is contained in:
Fable
2026-09-12 03:47:33 +02:00
parent 309661c9e4
commit 11b66a6c9f

View File

@@ -78,9 +78,9 @@ function readBody(req) {
const server = createServer(async (req, res) => { const server = createServer(async (req, res) => {
const { pathname } = new URL(req.url, BASE_URL); const { pathname } = new URL(req.url, BASE_URL);
if (req.method === 'GET' && pathname === '/') { if ((req.method === 'GET' || req.method === 'HEAD') && pathname === '/') {
res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' }); res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' });
res.end(INDEX_HTML); res.end(req.method === 'HEAD' ? undefined : INDEX_HTML);
return; return;
} }