(req, res)
| 386 | // ───────────────────────────────────────────────────────────────────────────── |
| 387 | |
| 388 | function parseUrlPath(req, res) { |
| 389 | const rawPath = (req.url ?? "/").split("?")[0]; |
| 390 | try { |
| 391 | return decodeURIComponent(rawPath); |
| 392 | } catch { |
| 393 | res.writeHead(400); |
| 394 | res.end("Bad Request"); |
| 395 | return null; |
| 396 | } |
| 397 | } |
| 398 | |
| 399 | function isGetOrHead(req) { |
| 400 | return req.method === "GET" || req.method === "HEAD"; |