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

Function redirectToMountedPath

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

Source from the content-addressed store, hash-verified

447}
448
449function 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
462function setStaticHeaders(res, pathname) {
463 const extension = extname(pathname).toLowerCase();

Callers 1

handleStaticFunction · 0.85

Calls 2

isGetOrHeadFunction · 0.85
looksLikeAssetRequestFunction · 0.85

Tested by

no test coverage detected