(req, res)
| 448 | // ───────────────────────────────────────────────────────────────────────────── |
| 449 | |
| 450 | function parseUrlPath(req, res) { |
| 451 | const rawPath = (req.url ?? "/").split("?")[0]; |
| 452 | try { |
| 453 | return decodeURIComponent(rawPath); |
| 454 | } catch { |
| 455 | res.writeHead(400); |
| 456 | res.end("Bad Request"); |
| 457 | return null; |
| 458 | } |
| 459 | } |
| 460 | |
| 461 | function isGetOrHead(req) { |
| 462 | return req.method === "GET" || req.method === "HEAD"; |