MCPcopy Index your code
hub / github.com/codeaashu/claude-code / getCustomHeaders

Function getCustomHeaders

src/services/api/client.ts:330–354  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

328}
329
330function getCustomHeaders(): Record<string, string> {
331 const customHeaders: Record<string, string> = {}
332 const customHeadersEnv = process.env.ANTHROPIC_CUSTOM_HEADERS
333
334 if (!customHeadersEnv) return customHeaders
335
336 // Split by newlines to support multiple headers
337 const headerStrings = customHeadersEnv.split(/\n|\r\n/)
338
339 for (const headerString of headerStrings) {
340 if (!headerString.trim()) continue
341
342 // Parse header in format "Name: Value" (curl style). Split on first `:`
343 // then trim — avoids regex backtracking on malformed long header lines.
344 const colonIdx = headerString.indexOf(':')
345 if (colonIdx === -1) continue
346 const name = headerString.slice(0, colonIdx).trim()
347 const value = headerString.slice(colonIdx + 1).trim()
348 if (name) {
349 customHeaders[name] = value
350 }
351 }
352
353 return customHeaders
354}
355
356export const CLIENT_REQUEST_ID_HEADER = 'x-client-request-id'
357

Callers 1

getAnthropicClientFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected