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