Responder a HEAD / con 200 (curl -I y monitores)
This commit is contained in:
@@ -78,9 +78,9 @@ function readBody(req) {
|
||||
const server = createServer(async (req, res) => {
|
||||
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.end(INDEX_HTML);
|
||||
res.end(req.method === 'HEAD' ? undefined : INDEX_HTML);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user