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

Function redirectToMountedPath

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

Source from the content-addressed store, hash-verified

445}
446
447function 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
460function setStaticHeaders(res, pathname) {
461 const extension = extname(pathname).toLowerCase();

Callers 1

handleStaticFunction · 0.85

Calls 2

isGetOrHeadFunction · 0.85
looksLikeAssetRequestFunction · 0.85

Tested by

no test coverage detected