MCPcopy Create free account
hub / github.com/ShipSecAI/studio / headersToHar

Function headersToHar

packages/component-sdk/src/http/har-builder.ts:52–64  ·  view source on GitHub ↗
(headers: HttpHeaders | Record<string, string>)

Source from the content-addressed store, hash-verified

50};
51
52export function headersToHar(headers: HttpHeaders | Record<string, string>): HarHeader[] {
53 const entries: HarHeader[] = [];
54 if (typeof (headers as HttpHeaders).forEach === 'function') {
55 (headers as HttpHeaders).forEach((value, name) => {
56 entries.push({ name, value });
57 });
58 } else {
59 Object.entries(headers as Record<string, string>).forEach(([name, value]) => {
60 entries.push({ name, value });
61 });
62 }
63 return entries;
64}
65
66export function maskHeaders(headers: HarHeader[], sensitive: string[]): HarHeader[] {
67 const sensitiveSet = normalizeSensitiveHeaders(sensitive);

Callers 2

buildHarRequestFunction · 0.85
buildHarResponseFunction · 0.85

Calls 1

pushMethod · 0.65

Tested by

no test coverage detected