(req, res, urlPath, basePath)
| 571 | } |
| 572 | |
| 573 | function redirectToMountedPath(req, res, urlPath, basePath) { |
| 574 | if (basePath === "/" || !isGetOrHead(req) || looksLikeAssetRequest(urlPath)) { |
| 575 | return false; |
| 576 | } |
| 577 | |
| 578 | const [, query = ""] = (req.url ?? "/").split("?", 2); |
| 579 | const path = urlPath === "/" ? "/" : urlPath; |
| 580 | const location = `${basePath}${path}${query ? `?${query}` : ""}`; |
| 581 | res.writeHead(308, { Location: location }); |
| 582 | res.end(); |
| 583 | return true; |
| 584 | } |
| 585 | |
| 586 | function setStaticHeaders(res, pathname) { |
| 587 | const extension = extname(pathname).toLowerCase(); |
no test coverage detected