Skip to content

Commit

Permalink
Change naming for networkDetailExcludeUrls to networkDetailDenyUrls
Browse files Browse the repository at this point in the history
  • Loading branch information
ziyad-elabid-nw committed Jul 3, 2023
1 parent 963982e commit 9f0ce30
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions packages/replay/src/coreHandlers/handleNetworkBreadcrumbs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function handleNetworkBreadcrumbs(replay: ReplayContainer): void {

const {
networkDetailAllowUrls,
networkDetailExcludeUrls,
networkDetailDenyUrls,
networkCaptureBodies,
networkRequestHeaders,
networkResponseHeaders,
Expand All @@ -43,7 +43,7 @@ export function handleNetworkBreadcrumbs(replay: ReplayContainer): void {
replay,
textEncoder,
networkDetailAllowUrls,
networkDetailExcludeUrls,
networkDetailDenyUrls,
networkCaptureBodies,
networkRequestHeaders,
networkResponseHeaders,
Expand Down
2 changes: 1 addition & 1 deletion packages/replay/src/coreHandlers/util/fetchUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ async function _prepareFetchData(
} = breadcrumb.data;

const captureDetails =
urlMatches(url, options.networkDetailAllowUrls) && !urlMatches(url, options.networkDetailExcludeUrls);
urlMatches(url, options.networkDetailAllowUrls) && !urlMatches(url, options.networkDetailDenyUrls);

const request = captureDetails
? _getRequestInfo(options, hint.input, requestBodySize)
Expand Down
2 changes: 1 addition & 1 deletion packages/replay/src/coreHandlers/util/xhrUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function _prepareXhrData(
return null;
}

if (!urlMatches(url, options.networkDetailAllowUrls) || urlMatches(url, options.networkDetailExcludeUrls)) {
if (!urlMatches(url, options.networkDetailAllowUrls) || urlMatches(url, options.networkDetailDenyUrls)) {
const request = buildSkippedNetworkRequestOrResponse(requestBodySize);
const response = buildSkippedNetworkRequestOrResponse(responseBodySize);
return {
Expand Down
4 changes: 2 additions & 2 deletions packages/replay/src/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class Replay implements Integration {
slowClickIgnoreSelectors = [],

networkDetailAllowUrls = [],
networkDetailExcludeUrls = [],
networkDetailDenyUrls = [],
networkCaptureBodies = true,
networkRequestHeaders = [],
networkResponseHeaders = [],
Expand Down Expand Up @@ -139,7 +139,7 @@ export class Replay implements Integration {
slowClickTimeout,
slowClickIgnoreSelectors,
networkDetailAllowUrls,
networkDetailExcludeUrls,
networkDetailDenyUrls,
networkCaptureBodies,
networkRequestHeaders: _getMergedNetworkHeaders(networkRequestHeaders),
networkResponseHeaders: _getMergedNetworkHeaders(networkResponseHeaders),
Expand Down
12 changes: 6 additions & 6 deletions packages/replay/src/types/replay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,31 +71,31 @@ export interface ReplayNetworkOptions {
networkDetailAllowUrls: (string | RegExp)[];

/**
* Exclude request/response details for XHR/Fetch requests that match the given URLs.
* Deny request/response details for XHR/Fetch requests that match the given URLs.
* The URLs can be strings or regular expressions.
* When provided a string, we will exclude any URL that contains the given string.
* When provided a string, we will deny any URL that contains the given string.
* You can use a Regex to handle exact matches or more complex matching.
* URLs matching these patterns will not have bodies & additional headers captured.
*/
networkDetailExcludeUrls: (string | RegExp)[];
networkDetailDenyUrls: (string | RegExp)[];

/**
* If request & response bodies should be captured.
* Only applies to URLs matched by `networkDetailAllowUrls` and not matched by `networkDetailExcludeUrls`.
* Only applies to URLs matched by `networkDetailAllowUrls` and not matched by `networkDetailDenyUrls`.
* Defaults to true.
*/
networkCaptureBodies: boolean;

/**
* Capture the following request headers, in addition to the default ones.
* Only applies to URLs matched by `networkDetailAllowUrls` and not matched by `networkDetailExcludeUrls`.
* Only applies to URLs matched by `networkDetailAllowUrls` and not matched by `networkDetailDenyUrls`.
* Any headers defined here will be captured in addition to the default headers.
*/
networkRequestHeaders: string[];

/**
* Capture the following response headers, in addition to the default ones.
* Only applies to URLs matched by `networkDetailAllowUrls` and not matched by `networkDetailExcludeUrls`.
* Only applies to URLs matched by `networkDetailAllowUrls` and not matched by `networkDetailDenyUrls`.
* Any headers defined here will be captured in addition to the default headers.
*/
networkResponseHeaders: string[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('Unit | coreHandlers | handleNetworkBreadcrumbs', () => {
textEncoder: new TextEncoder(),
replay: setupReplayContainer(),
networkDetailAllowUrls: ['https://example.com'],
networkDetailExcludeUrls: ['http://localhost:8080'],
networkDetailDenyUrls: ['http://localhost:8080'],
networkCaptureBodies: false,
networkRequestHeaders: ['content-type', 'accept', 'x-custom-header'],
networkResponseHeaders: ['content-type', 'accept', 'x-custom-header'],
Expand Down Expand Up @@ -1390,8 +1390,8 @@ other-header: test`;
['exact regex match', 'http://example.com/exact'],
['partial regex match', 'http://example.com/partial/string'],
])('matching URL %s', (_label, url) => {
it('correctly excludes URL for fetch request', async () => {
options.networkDetailExcludeUrls = [
it('correctly deny URL for fetch request', async () => {
options.networkDetailDenyUrls = [
'https://example.com/foo',
'com/bar',
/^http:\/\/example.com\/exact$/,
Expand Down Expand Up @@ -1465,8 +1465,8 @@ other-header: test`;
]);
});

it('correctly excludes URL for xhr request', async () => {
options.networkDetailExcludeUrls = [
it('correctly deny URL for xhr request', async () => {
options.networkDetailDenyUrls = [
'https://example.com/foo',
'com/bar',
/^http:\/\/example.com\/exact$/,
Expand Down
2 changes: 1 addition & 1 deletion packages/replay/test/utils/setupReplayContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const DEFAULT_OPTIONS = {
useCompression: false,
blockAllMedia: true,
networkDetailAllowUrls: [],
networkDetailExcludeUrls: [],
networkDetailDenyUrls: [],
networkCaptureBodies: true,
networkRequestHeaders: [],
networkResponseHeaders: [],
Expand Down

0 comments on commit 9f0ce30

Please sign in to comment.