(req, res, urlPath, basePath)
| 447 | } |
| 448 | |
| 449 | function redirectToMountedPath(req, res, urlPath, basePath) { |
| 450 | if (basePath === "/" || !isGetOrHead(req) || looksLikeAssetRequest(urlPath)) { |
| 451 | return false; |
| 452 | } |
| 453 | |
| 454 | const [, query = ""] = (req.url ?? "/").split("?", 2); |
| 455 | const path = urlPath === "/" ? "/" : urlPath; |
| 456 | const location = `${basePath}${path}${query ? `?${query}` : ""}`; |
| 457 | res.writeHead(308, { Location: location }); |
| 458 | res.end(); |
| 459 | return true; |
| 460 | } |
| 461 | |
| 462 | function setStaticHeaders(res, pathname) { |
| 463 | const extension = extname(pathname).toLowerCase(); |
no test coverage detected