Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function(this: SentryWrappedXMLHttpRequest, ...args: any[]): void {
const url = args[1];
this.__sentry_xhr__ = {
method: isString(args[0]) ? args[0].toUpperCase() : args[0],
url: args[1],
};
const client = getCurrentHub().getClient();
const dsn = client && client.getDsn();
if (dsn) {
const filterUrl = new API(dsn).getStoreEndpoint();
// if Sentry key appears in URL, don't capture it as a request
// but rather as our own 'sentry' type breadcrumb
if (isString(url) && (filterUrl && url.indexOf(filterUrl) !== -1)) {
this.__sentry_own_request__ = true;
}
}
return originalOpen.apply(this, args);
},
);
function fetchBreadcrumb(handlerData: { [key: string]: any }): void {
// We only capture complete fetch requests
if (!handlerData.requestComplete) {
return;
}
const client = getCurrentHub().getClient();
const dsn = client && client.getDsn();
if (dsn) {
const filterUrl = new API(dsn).getStoreEndpoint();
// if Sentry key appears in URL, don't capture it as a request
// but rather as our own 'sentry' type breadcrumb
if (
filterUrl &&
handlerData.fetchData.url.indexOf(filterUrl) !== -1 &&
handlerData.fetchData.method === 'POST' &&
handlerData.args[1] &&
handlerData.args[1].body
) {
addSentryBreadcrumb(handlerData.args[1].body);
return;
}
}
if (handlerData.error) {
getCurrentHub().addBreadcrumb(
public constructor(public options: TransportOptions) {
this._api = new API(options.dsn);
}
const dsn = options.dsn || this.getDsn();
if (!options.eventId) {
logger.error('Missing `eventId` option in showReportDialog call');
return;
}
if (!dsn) {
logger.error('Missing `Dsn` option in showReportDialog call');
return;
}
const script = document.createElement('script');
script.async = true;
script.src = new API(dsn).getReportDialogEndpoint(options);
if (options.onLoad) {
script.onload = options.onLoad;
}
(document.head || document.body).appendChild(script);
}
}
public constructor(public options: TransportOptions) {
this.url = new API(this.options.dsn).getStoreEndpointWithUrlEncodedAuth();
}