MCPcopy Create free account
hub / github.com/oboard/claude-code-rev / buildHeaders

Function buildHeaders

src/services/api/openaiCompatibleClient.ts:726–753  ·  view source on GitHub ↗
(
  providerType: OpenAICompatibleProviderType,
  authToken: string | undefined,
  defaultHeaders: Record<string, string>,
  extraHeaders?: Record<string, string>,
)

Source from the content-addressed store, hash-verified

724}
725
726function buildHeaders(
727 providerType: OpenAICompatibleProviderType,
728 authToken: string | undefined,
729 defaultHeaders: Record<string, string>,
730 extraHeaders?: Record<string, string>,
731): Headers {
732 const headers = new Headers({
733 ...defaultHeaders,
734 'content-type': 'application/json',
735 ...(providerType === 'github-models'
736 ? {
737 Accept: 'application/vnd.github+json',
738 'X-GitHub-Api-Version': '2022-11-28',
739 }
740 : providerType === 'github-copilot'
741 ? {
742 Accept: 'application/json',
743 'Editor-Version': `claude-code/${MACRO.VERSION}`,
744 'Editor-Plugin-Version': `claude-code/${MACRO.VERSION}`,
745 }
746 : {}),
747 ...(extraHeaders ?? {}),
748 })
749 if (authToken) {
750 headers.set('Authorization', `Bearer ${authToken}`)
751 }
752 return headers
753}
754
755function buildSignal(
756 signal: AbortSignal | undefined,

Callers 1

createFunction · 0.85

Calls 1

setMethod · 0.65

Tested by

no test coverage detected