MCPcopy
hub / github.com/coder/mux / stripAppProxyBasePath

Function stripAppProxyBasePath

src/common/appProxyBasePath.ts:24–38  ·  view source on GitHub ↗
(pathname: string)

Source from the content-addressed store, hash-verified

22}
23
24export function stripAppProxyBasePath(pathname: string): {
25 basePath: string | null;
26 routePathname: string;
27} {
28 const basePath = getAppProxyBasePathFromPathname(pathname);
29 if (!basePath) {
30 return { basePath: null, routePathname: pathname };
31 }
32
33 const routePathname = pathname.slice(basePath.length);
34 return {
35 basePath,
36 routePathname: routePathname.length === 0 ? "/" : routePathname,
37 };
38}

Calls 1

Tested by

no test coverage detected