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

Function originHost

packages/server/src/middleware/origin.ts:54–63  ·  view source on GitHub ↗
(origin: string | undefined)

Source from the content-addressed store, hash-verified

52 * or `undefined` when the origin is missing or malformed.
53 */
54export function originHost(origin: string | undefined): string | undefined {
55 if (origin === undefined) {
56 return undefined;
57 }
58 try {
59 return new URL(origin).host;
60 } catch {
61 return undefined;
62 }
63}
64
65/**
66 * Decide whether an `Origin` is allowed for a request to `host`.

Callers 2

origin.test.tsFile · 0.90
isOriginAllowedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected