Skip to content

Commit d8acbc7

Browse files
trace and interceptors in index
1 parent 0485c2c commit d8acbc7

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

packages/compass/src/app/index.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,36 @@ import { defaultPreferencesInstance } from 'compass-preferences-model';
1111
import semver from 'semver';
1212
import { CompassElectron } from './components/entrypoint';
1313
import { openToast } from '@mongodb-js/compass-components';
14+
import http from 'http';
15+
import https from 'https';
16+
17+
console.log('DJECHLIN WE ARE IN INDEX');
18+
19+
// Intercept HTTP requests
20+
const originalHttpRequest = http.request;
21+
http.request = function (...args: any[]) {
22+
console.log('DJECHLIN HTTP Request:', args);
23+
log.error(
24+
mongoLogId(1_001_818_275),
25+
'DJECHLIN',
26+
'DJECHLIN HTTP REQUEST HAPPENED OH NO',
27+
{ message: args }
28+
);
29+
return originalHttpRequest.apply(this, args as any);
30+
};
31+
32+
// Intercept HTTPS requests
33+
const originalHttpsRequest = https.request;
34+
https.request = function (...args: any[]) {
35+
console.log('DJECHLIN HTTPS Request:', args);
36+
log.error(
37+
mongoLogId(1_001_818_276),
38+
'DJECHLIN',
39+
'DJECHLIN HTTPS SSSSSSSSSS REQUEST HAPPENED OH NO',
40+
{ message: args }
41+
);
42+
return originalHttpsRequest.apply(this, args as any);
43+
};
1444

1545
// https://github.com/nodejs/node/issues/40537
1646
dns.setDefaultResultOrder('ipv4first');

0 commit comments

Comments
 (0)