mirror of
https://github.com/di-sukharev/opencommit.git
synced 2026-04-20 03:02:51 -04:00
Support explicit proxy disabling and ambient proxy fallback without leaking env state into config. Improve first-run detection, endpoint-specific error messaging, diff exclusions, and runtime helper boundaries covered by unit tests.
22 lines
457 B
TypeScript
22 lines
457 B
TypeScript
export function parseCustomHeaders(headers: any): Record<string, string> {
|
|
let parsedHeaders = {};
|
|
|
|
if (!headers) {
|
|
return parsedHeaders;
|
|
}
|
|
|
|
try {
|
|
if (typeof headers === 'object' && !Array.isArray(headers)) {
|
|
parsedHeaders = headers;
|
|
} else {
|
|
parsedHeaders = JSON.parse(headers);
|
|
}
|
|
} catch {
|
|
console.warn(
|
|
'Invalid OCO_API_CUSTOM_HEADERS format, ignoring custom headers'
|
|
);
|
|
}
|
|
|
|
return parsedHeaders;
|
|
}
|