MCPcopy Create free account
hub / github.com/OpenHands/OpenHands / redirectToMountedPath

Function redirectToMountedPath

scripts/static-server.mjs:573–584  ·  view source on GitHub ↗
(req, res, urlPath, basePath)

Source from the content-addressed store, hash-verified

571}
572
573function 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
586function setStaticHeaders(res, pathname) {
587 const extension = extname(pathname).toLowerCase();

Callers 1

handleStaticFunction · 0.85

Calls 2

isGetOrHeadFunction · 0.85
looksLikeAssetRequestFunction · 0.85

Tested by

no test coverage detected