(req, res)
| 512 | // ───────────────────────────────────────────────────────────────────────────── |
| 513 | |
| 514 | function parseUrlPath(req, res) { |
| 515 | const rawPath = (req.url ?? "/").split("?")[0]; |
| 516 | try { |
| 517 | return decodeURIComponent(rawPath); |
| 518 | } catch { |
| 519 | res.writeHead(400); |
| 520 | res.end("Bad Request"); |
| 521 | return null; |
| 522 | } |
| 523 | } |
| 524 | |
| 525 | function isGetOrHead(req) { |
| 526 | return req.method === "GET" || req.method === "HEAD"; |