package.build.npm.cjs.integrations.httpcontext.js.map Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of browser Show documentation
Show all versions of browser Show documentation
Official Sentry SDK for browsers
{"version":3,"file":"httpcontext.js","sources":["../../../../src/integrations/httpcontext.ts"],"sourcesContent":["import { defineIntegration } from '@sentry/core';\nimport { WINDOW } from '../helpers';\n\n/**\n * Collects information about HTTP request headers and\n * attaches them to the event.\n */\nexport const httpContextIntegration = defineIntegration(() => {\n return {\n name: 'HttpContext',\n preprocessEvent(event) {\n // if none of the information we want exists, don't bother\n if (!WINDOW.navigator && !WINDOW.location && !WINDOW.document) {\n return;\n }\n\n // grab as much info as exists and add it to the event\n const url = (event.request && event.request.url) || (WINDOW.location && WINDOW.location.href);\n const { referrer } = WINDOW.document || {};\n const { userAgent } = WINDOW.navigator || {};\n\n const headers = {\n ...(event.request && event.request.headers),\n ...(referrer && { Referer: referrer }),\n ...(userAgent && { 'User-Agent': userAgent }),\n };\n const request = { ...event.request, ...(url && { url }), headers };\n\n event.request = request;\n },\n };\n});\n"],"names":["defineIntegration","WINDOW"],"mappings":";;;;;AAGA;AACA;AACA;AACA;MACa,sBAAuB,GAAEA,sBAAiB,CAAC,MAAM;AAC9D,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,aAAa;AACvB,IAAI,eAAe,CAAC,KAAK,EAAE;AAC3B;AACA,MAAM,IAAI,CAACC,cAAM,CAAC,aAAa,CAACA,cAAM,CAAC,YAAY,CAACA,cAAM,CAAC,QAAQ,EAAE;AACrE,QAAQ,OAAM;AACd,OAAM;AACN;AACA;AACA,MAAM,MAAM,GAAI,GAAE,CAAC,KAAK,CAAC,OAAQ,IAAG,KAAK,CAAC,OAAO,CAAC,GAAG,MAAMA,cAAM,CAAC,QAAA,IAAYA,cAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;AACnG,MAAM,MAAM,EAAE,QAAA,EAAW,GAAEA,cAAM,CAAC,QAAA,IAAY,EAAE,CAAA;AAChD,MAAM,MAAM,EAAE,SAAA,EAAY,GAAEA,cAAM,CAAC,SAAA,IAAa,EAAE,CAAA;AAClD;AACA,MAAM,MAAM,UAAU;AACtB,QAAQ,IAAI,KAAK,CAAC,OAAA,IAAW,KAAK,CAAC,OAAO,CAAC,OAAO;AAClD,QAAQ,IAAI,QAAS,IAAG,EAAE,OAAO,EAAE,QAAS,EAAC;AAC7C,QAAQ,IAAI,SAAU,IAAG,EAAE,YAAY,EAAE,SAAU,EAAC;AACpD,OAAO,CAAA;AACP,MAAM,MAAM,OAAQ,GAAE,EAAE,GAAG,KAAK,CAAC,OAAO,EAAE,IAAI,GAAA,IAAO,EAAE,GAAA,EAAK,GAAG,SAAS,CAAA;AACxE;AACA,MAAM,KAAK,CAAC,OAAQ,GAAE,OAAO,CAAA;AAC7B,KAAK;AACL,GAAG,CAAA;AACH,CAAC;;;;"}