MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / winterCGHeadersToDict

Function winterCGHeadersToDict

packages/core/src/utils/request.ts:49–63  ·  view source on GitHub ↗
(winterCGHeaders: WebFetchHeaders)

Source from the content-addressed store, hash-verified

47 * The header keys will be lower case: e.g. A "Content-Type" header will be stored as "content-type".
48 */
49export function winterCGHeadersToDict(winterCGHeaders: WebFetchHeaders): Record<string, string> {
50 const headers: Record<string, string> = {};
51 try {
52 winterCGHeaders.forEach((value, key) => {
53 if (typeof value === 'string') {
54 // We check that value is a string even though it might be redundant to make sure prototype pollution is not possible.
55 headers[key] = value;
56 }
57 });
58 } catch {
59 // just return the empty headers
60 }
61
62 return headers;
63}
64
65/**
66 * Convert common request headers to a simple dictionary.

Callers 12

wrapRequestHandlerFunction · 0.90
request.test.tsFile · 0.90
addHeadersAsAttributesFunction · 0.90
resolveWithSentryFunction · 0.90
instrumentHandleFunction · 0.90
wrapDenoRequestHandlerFunction · 0.90
wrapRequestHandlerFunction · 0.90

Calls 1

forEachMethod · 0.65

Tested by

no test coverage detected