MCPcopy Index your code
hub / github.com/CopilotKit/CopilotKit / setHeaders

Method setHeaders

packages/core/src/core/core.ts:719–732  ·  view source on GitHub ↗

* Replace the headers sent with every runtime request. * * This is an overwrite, not a merge — the supplied object becomes the * complete header set. Entries whose value is `null` or `undefined` are * dropped, which is how you clear a header (e.g. removing `Authorization` * on logout)

(headers: Record<string, string | null | undefined>)

Source from the content-addressed store, hash-verified

717 * core-level headers.
718 */
719 setHeaders(headers: Record<string, string | null | undefined>): void {
720 this._headers = normalizeHeaders(headers);
721 this.agentRegistry.applyHeadersToAgents(
722 this.agentRegistry.agents as Record<string, AbstractAgent>,
723 );
724 void this.notifySubscribers(
725 (subscriber) =>
726 subscriber.onHeadersChanged?.({
727 copilotkit: this,
728 headers: this.headers,
729 }),
730 "Subscriber onHeadersChanged error:",
731 );
732 }
733
734 setCredentials(credentials: RequestCredentials | undefined): void {
735 this._credentials = credentials;

Callers 4

CopilotKitProviderFunction · 0.45
CopilotKitProviderFunction · 0.45

Calls 3

notifySubscribersMethod · 0.95
normalizeHeadersFunction · 0.85
applyHeadersToAgentsMethod · 0.80

Tested by

no test coverage detected