Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
1 line
1.5 KiB
Plaintext
1 line
1.5 KiB
Plaintext
{"version":3,"file":"addHeadersAsAttributes.js","sources":["../../../../src/common/utils/addHeadersAsAttributes.ts"],"sourcesContent":["import type { Span, WebFetchHeaders } from '@sentry/core';\nimport { getClient, httpHeadersToSpanAttributes, winterCGHeadersToDict } from '@sentry/core';\n\n/**\n * Extracts HTTP request headers as span attributes and optionally applies them to a span.\n */\nexport function addHeadersAsAttributes(\n headers: WebFetchHeaders | Headers | Record<string, string | string[] | undefined> | undefined,\n span?: Span,\n): Record<string, string> {\n if (!headers) {\n return {};\n }\n\n const headersDict: Record<string, string | string[] | undefined> =\n headers instanceof Headers || (typeof headers === 'object' && 'get' in headers)\n ? winterCGHeadersToDict(headers as Headers)\n : headers;\n\n const headerAttributes = httpHeadersToSpanAttributes(headersDict, getClient()?.getOptions().sendDefaultPii ?? false);\n\n if (span) {\n span.setAttributes(headerAttributes);\n }\n\n return headerAttributes;\n}\n"],"names":[],"mappings":";;AAGA;AACA;AACA;AACO,SAAS,sBAAsB;AACtC,EAAE,OAAO;AACT,EAAE,IAAI;AACN,EAA0B;AAC1B,EAAE,IAAI,CAAC,OAAO,EAAE;AAChB,IAAI,OAAO,EAAE;AACb,EAAE;;AAEF,EAAE,MAAM,WAAW;AACnB,IAAI,OAAA,YAAmB,OAAA,KAAY,OAAO,OAAA,KAAY,QAAA,IAAY,KAAA,IAAS,OAAO;AAClF,QAAQ,qBAAqB,CAAC,OAAA;AAC9B,QAAQ,OAAO;;AAEf,EAAE,MAAM,gBAAA,GAAmB,2BAA2B,CAAC,WAAW,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,CAAC,cAAA,IAAkB,KAAK,CAAC;;AAEtH,EAAE,IAAI,IAAI,EAAE;AACZ,IAAI,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC;AACxC,EAAE;;AAEF,EAAE,OAAO,gBAAgB;AACzB;;;;"} |