@@ -226,15 +226,15 @@ function instrumentXHR(): void {
226
226
// eslint-disable-next-line @typescript-eslint/no-this-alias
227
227
const xhr = this ;
228
228
const url = args [ 1 ] ;
229
- xhr . __sentry_xhr__ = {
229
+ const xhrInfo : SentryWrappedXMLHttpRequest [ '__sentry_xhr__' ] = ( xhr . __sentry_xhr__ = {
230
230
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
231
231
method : isString ( args [ 0 ] ) ? args [ 0 ] . toUpperCase ( ) : args [ 0 ] ,
232
232
url : args [ 1 ] ,
233
- } ;
233
+ } ) ;
234
234
235
235
// if Sentry key appears in URL, don't capture it as a request
236
236
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
237
- if ( isString ( url ) && xhr . __sentry_xhr__ . method === 'POST' && url . match ( / s e n t r y _ k e y / ) ) {
237
+ if ( isString ( url ) && xhrInfo . method === 'POST' && url . match ( / s e n t r y _ k e y / ) ) {
238
238
xhr . __sentry_own_request__ = true ;
239
239
}
240
240
@@ -243,9 +243,7 @@ function instrumentXHR(): void {
243
243
try {
244
244
// touching statusCode in some platforms throws
245
245
// an exception
246
- if ( xhr . __sentry_xhr__ ) {
247
- xhr . __sentry_xhr__ . status_code = xhr . status ;
248
- }
246
+ xhrInfo . status_code = xhr . status ;
249
247
} catch ( e ) {
250
248
/* do nothing */
251
249
}
@@ -256,8 +254,8 @@ function instrumentXHR(): void {
256
254
// Make sure to pop both key and value to keep it in sync.
257
255
requestKeys . splice ( requestPos ) ;
258
256
const args = requestValues . splice ( requestPos ) [ 0 ] ;
259
- if ( xhr . __sentry_xhr__ && args [ 0 ] !== undefined ) {
260
- xhr . __sentry_xhr__ . body = args [ 0 ] as XHRSendInput ;
257
+ if ( args [ 0 ] !== undefined ) {
258
+ xhrInfo . body = args [ 0 ] as XHRSendInput ;
261
259
}
262
260
}
263
261
} catch ( e ) {
0 commit comments