copilotRequestHeaders function

Map<String, String> copilotRequestHeaders({
  1. required String copilotToken,
})

The Copilot API request headers for whichever bearer copilotToken carries the call: an exchanged short-lived token keeps the vscode-chat identity; a raw fine-grained PAT presents the Copilot CLI identity (the only shape the API accepts a PAT with).

Implementation

Map<String, String> copilotRequestHeaders({required String copilotToken}) =>
    isFineGrainedGitHubPat(copilotToken)
    ? copilotPatApiHeaders(pat: copilotToken)
    : copilotApiHeaders(copilotToken: copilotToken);