MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / normalizeServerOrigin

Function normalizeServerOrigin

apps/kimi-web/src/api/config.ts:43–50  ·  view source on GitHub ↗
(value: string | undefined)

Source from the content-addressed store, hash-verified

41}
42
43export function normalizeServerOrigin(value: string | undefined): string {
44 const raw = value && value.trim() ? value : defaultServerOrigin();
45 const url = new URL(raw);
46 url.pathname = url.pathname.replace(/\/v1\/?$/, '').replace(/\/$/, '');
47 url.search = '';
48 url.hash = '';
49 return url.toString().replace(/\/$/, '');
50}
51
52/** Strip the scheme for a compact display origin: `http://127.0.0.1:58627` → `127.0.0.1:58627`. */
53function shortOrigin(origin: string): string {

Callers 2

readKimiApiConfigFunction · 0.70
serverEndpointLabelFunction · 0.70

Calls 2

defaultServerOriginFunction · 0.85
toStringMethod · 0.65

Tested by

no test coverage detected