Files
klz-cables.com/.pnpm-store/v10/files/b2/c37b8a2e215e84b1572a68bbd81901640f6c0c3b22aab3b5a533326841499068ed37866b670c47bd80ebbfa74e36cf5f0dbbc30f86621e8dde67cbe5998989
Marc Mintel 5397309103
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
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

1 line
5.5 KiB
Plaintext

{"version":3,"file":"networkUtils.js","sources":["../../src/networkUtils.ts"],"sourcesContent":["import { debug } from '@sentry/core';\nimport { DEBUG_BUILD } from './debug-build';\nimport type { NetworkMetaWarning } from './types';\n\n// Symbol used by e.g. the Replay integration to store original body on Request objects\nexport const ORIGINAL_REQ_BODY = Symbol.for('sentry__originalRequestBody');\n\n/**\n * Serializes FormData.\n *\n * This is a bit simplified, but gives us a decent estimate.\n * This converts e.g. { name: 'Anne Smith', age: 13 } to 'name=Anne+Smith&age=13'.\n *\n */\nexport function serializeFormData(formData: FormData): string {\n // @ts-expect-error passing FormData to URLSearchParams actually works\n return new URLSearchParams(formData).toString();\n}\n\n/** Get the string representation of a body. */\nexport function getBodyString(body: unknown, _debug: typeof debug = debug): [string | undefined, NetworkMetaWarning?] {\n try {\n if (typeof body === 'string') {\n return [body];\n }\n\n if (body instanceof URLSearchParams) {\n return [body.toString()];\n }\n\n if (body instanceof FormData) {\n return [serializeFormData(body)];\n }\n\n if (!body) {\n return [undefined];\n }\n } catch (error) {\n DEBUG_BUILD && _debug.error(error, 'Failed to serialize body', body);\n return [undefined, 'BODY_PARSE_ERROR'];\n }\n\n DEBUG_BUILD && _debug.log('Skipping network body because of body type', body);\n\n return [undefined, 'UNPARSEABLE_BODY_TYPE'];\n}\n\n/**\n * Parses the fetch arguments to extract the request payload.\n *\n * In case of a Request object, this function attempts to retrieve the original body by looking for a Sentry-patched symbol.\n */\nexport function getFetchRequestArgBody(fetchArgs: unknown[] = []): RequestInit['body'] | undefined {\n // Second argument with body options takes precedence\n if (fetchArgs.length >= 2 && fetchArgs[1] && typeof fetchArgs[1] === 'object' && 'body' in fetchArgs[1]) {\n return (fetchArgs[1] as RequestInit).body;\n }\n\n if (fetchArgs.length >= 1 && fetchArgs[0] instanceof Request) {\n const request = fetchArgs[0];\n /* The Request interface's body is a ReadableStream, which we cannot directly access.\n Some integrations (e.g. Replay) patch the Request object to store the original body. */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n const originalBody = (request as any)[ORIGINAL_REQ_BODY];\n if (originalBody !== undefined) {\n return originalBody;\n }\n\n return undefined; // Fall back to returning undefined (as we don't want to return a ReadableStream)\n }\n\n return undefined;\n}\n\n/**\n * Parses XMLHttpRequest response headers into a Record.\n * Extracted from replay internals to be reusable.\n */\nexport function parseXhrResponseHeaders(xhr: XMLHttpRequest): Record<string, string> {\n let headers: string | undefined;\n try {\n headers = xhr.getAllResponseHeaders();\n } catch (error) {\n DEBUG_BUILD && debug.error(error, 'Failed to get xhr response headers', xhr);\n return {};\n }\n\n if (!headers) {\n return {};\n }\n\n return headers.split('\\r\\n').reduce((acc: Record<string, string>, line: string) => {\n const [key, value] = line.split(': ') as [string, string | undefined];\n if (value) {\n acc[key.toLowerCase()] = value;\n }\n return acc;\n }, {});\n}\n"],"names":[],"mappings":";;;AAIA;AACO,MAAM,oBAAoB,MAAM,CAAC,GAAG,CAAC,6BAA6B;;AAEzE;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,QAAQ,EAAoB;AAC9D;AACA,EAAE,OAAO,IAAI,eAAe,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE;AACjD;;AAEA;AACO,SAAS,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