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

Function parseKimiCodeCustomHeaders

packages/oauth/src/identity.ts:124–138  ·  view source on GitHub ↗
(
  env: NodeJS.ProcessEnv = process.env,
)

Source from the content-addressed store, hash-verified

122export const KIMI_CODE_CUSTOM_HEADERS_ENV = 'KIMI_CODE_CUSTOM_HEADERS';
123
124export function parseKimiCodeCustomHeaders(
125 env: NodeJS.ProcessEnv = process.env,
126): Record<string, string> {
127 const raw = env[KIMI_CODE_CUSTOM_HEADERS_ENV]?.trim();
128 if (raw === undefined || raw.length === 0) return {};
129 const headers: Record<string, string> = {};
130 for (const line of raw.split('\n')) {
131 const colon = line.indexOf(':');
132 if (colon < 0) continue;
133 const name = line.slice(0, colon).trim();
134 if (name.length === 0) continue;
135 headers[name] = line.slice(colon + 1).trim();
136 }
137 return headers;
138}
139
140export function assertKimiHostIdentity(identity: KimiHostIdentity | undefined): KimiHostIdentity {
141 if (identity === undefined) {

Callers 4

fetchOpenPlatformModelsFunction · 0.90
resolveProviderConfigMethod · 0.85
toKosongProviderConfigFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected