getsentry / getsentry/sentry-javascript

Stop setting `event.request` in Browser SDKs

Aperta
#15,845 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Task
Lingua principale
TypeScript
Stelle
8.7k
Fork
1.8k
Merge medio
1g 17h
PR unite (30g)
515

Descrizione

### Description

Today, we set data about the current page on `event.request` in the Browser SDK. This is done by the HttpContext integration:

```ts
// if none of the information we want exists, don't bother
if (!WINDOW.navigator && !WINDOW.location && !WINDOW.document) {
return;
}

// grab as much info as exists and add it to the event
const url = event.request?.url || getLocationHref();
const { referrer } = WINDOW.document || {};
const { userAgent } = WINDOW.navigator || {};

const headers = {
...event.request?.headers,
...(referrer && { Referer: referrer }),
...(userAgent && { 'User-Agent': userAgent }),
};
const request = {
...event.request,
...(url && { url }),
headers,
};

event.request = request;
```

In product, we show this as "HTTP Request Information" which is pretty confusing. We should stop setting this for browser SDKs, and instead set this information in a different place (e.g. in a `page` context, TBD).

We can then think about instead using this place to store outgoing-request information for failed fetch calls.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.