mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-09-22 06:00:56 +02:00
🏷️ refactor: Normalize Request Headers in setRequestHeaders
(#9106)
This commit is contained in:
parent
80a1a57fde
commit
a6fd32a15a
1 changed files with 11 additions and 2 deletions
|
@ -88,8 +88,17 @@ export class MCPConnection extends EventEmitter {
|
||||||
url?: string;
|
url?: string;
|
||||||
|
|
||||||
setRequestHeaders(headers: Record<string, string> | null): void {
|
setRequestHeaders(headers: Record<string, string> | null): void {
|
||||||
logger.debug(`${this.getLogPrefix()} Setting request headers: ${JSON.stringify(headers)}`);
|
if (!headers) {
|
||||||
this.requestHeaders = headers;
|
return;
|
||||||
|
}
|
||||||
|
const normalizedHeaders: Record<string, string> = {};
|
||||||
|
for (const [key, value] of Object.entries(headers)) {
|
||||||
|
normalizedHeaders[key.toLowerCase()] = value;
|
||||||
|
}
|
||||||
|
logger.debug(
|
||||||
|
`${this.getLogPrefix()} Setting request headers: ${JSON.stringify(normalizedHeaders)}`,
|
||||||
|
);
|
||||||
|
this.requestHeaders = normalizedHeaders;
|
||||||
}
|
}
|
||||||
|
|
||||||
getRequestHeaders(): Record<string, string> | null | undefined {
|
getRequestHeaders(): Record<string, string> | null | undefined {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue