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

Function formatHostErrorMessage

packages/server/src/middleware/hostnames.ts:106–111  ·  view source on GitHub ↗
(host: string | undefined)

Source from the content-addressed store, hash-verified

104}
105
106export function formatHostErrorMessage(host: string | undefined): string {
107 const normalizedHost = host === undefined || host.length === 0 ? undefined : stripPort(host);
108 const hostLabel = normalizedHost ?? '<missing>';
109 const hostArg = normalizedHost ?? '<host>';
110 return `Invalid Host header: ${hostLabel}; allow this host with KIMI_CODE_ALLOWED_HOSTS=${hostArg} or 'kimi server run --allowed-host ${hostArg}'.`;
111}
112
113/**
114 * Decide whether a `Host` value is allowed under the given options.

Callers 2

hostnames.test.tsFile · 0.90
onRequestFunction · 0.85

Calls 1

stripPortFunction · 0.85

Tested by

no test coverage detected