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