-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathsdk.ts
More file actions
24 lines (22 loc) · 866 Bytes
/
sdk.ts
File metadata and controls
24 lines (22 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { getDefaultIntegrations, init as initCore } from '@sentry/core';
import { httpIntegration } from './integrations/http';
export const defaultIntegrations = [...getDefaultIntegrations(), httpIntegration()];
export function init(options: any): void {
const integrations = options.integrations || defaultIntegrations;
initCore({
...options,
integrations,
beforeSend(event) {
if (event.contexts?.response?.headers) {
const headers = event.contexts.response.headers as Record<string, string | string[] | undefined>;
const sensitiveHeaders = ['set-cookie', 'cookie', 'authorization'];
for (const header of sensitiveHeaders) {
if (headers[header]) {
headers[header] = '[Filtered]';
}
}
}
return options.beforeEvent ? options.beforeEvent(event) : event;
},
});
}