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

Function getHttpRequestData

packages/browser/src/helpers.ts:191–207  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

189 * Get HTTP request data from the current page.
190 */
191export function getHttpRequestData(): { url: string; headers: Record<string, string> } {
192 // grab as much info as exists and add it to the event
193 const url = getLocationHref();
194 const { referrer } = WINDOW.document || {};
195 const { userAgent } = WINDOW.navigator || {};
196
197 const headers = {
198 ...(referrer && { Referer: referrer }),
199 ...(userAgent && { 'User-Agent': userAgent }),
200 };
201 const request = {
202 url,
203 headers,
204 };
205
206 return request;
207}

Callers 4

preprocessEventFunction · 0.90
processSegmentSpanFunction · 0.90
setupFunction · 0.90

Calls 1

getLocationHrefFunction · 0.90

Tested by

no test coverage detected