File tree 2 files changed +23
-2
lines changed 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -3,15 +3,16 @@ import { getCurrentHub } from '@sentry/core';
3
3
import type { ReplayContainer } from '../types' ;
4
4
5
5
/**
6
- * Check whether a given request URL should be filtered out.
6
+ * Check whether a given request URL should be filtered out. This is so we
7
+ * don't log Sentry ingest requests.
7
8
*/
8
9
export function shouldFilterRequest ( replay : ReplayContainer , url : string ) : boolean {
9
10
// If we enabled the `traceInternals` experiment, we want to trace everything
10
11
if ( __DEBUG_BUILD__ && replay . getOptions ( ) . _experiments . traceInternals ) {
11
12
return false ;
12
13
}
13
14
14
- return ! _isSentryRequest ( url ) ;
15
+ return _isSentryRequest ( url ) ;
15
16
}
16
17
17
18
/**
Original file line number Diff line number Diff line change
1
+ import { shouldFilterRequest } from '../../src/util/shouldFilterRequest' ;
2
+ import { mockSdk } from '../index' ;
3
+
4
+ describe ( 'Integration | shouldFilterRequest' , ( ) => {
5
+ beforeEach ( ( ) => {
6
+ jest . resetModules ( ) ;
7
+ } ) ;
8
+
9
+ it ( 'should not filter requests from non-Sentry ingest URLs' , async ( ) => {
10
+ const { replay } = await mockSdk ( ) ;
11
+
12
+ expect ( shouldFilterRequest ( replay , 'https://example.com/foo' ) ) . toBe ( false ) ;
13
+ } ) ;
14
+
15
+ it ( 'should filter requests for Sentry ingest URLs' , async ( ) => {
16
+ const { replay } = await mockSdk ( ) ;
17
+
18
+ expect ( shouldFilterRequest ( replay , 'https://03031aa.ingest.f00.f00/api/129312/' ) ) . toBe ( true ) ;
19
+ } ) ;
20
+ } ) ;
You can’t perform that action at this time.
0 commit comments