Skip to content

Commit bc72899

Browse files
fix(preview): Add mirage handlers for diagnostics endpoints (#1873)
1 parent fd5dd48 commit bc72899

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

src/mirage/index.ts

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,50 @@ export const startMirage = ({ environment = 'development' } = {}) => {
975975
};
976976
break;
977977
}
978+
case 'AllTargetsHeapDumps':
979+
case 'HeapDumpCountForTarget':
980+
case 'HeapDumpsForTarget':
981+
data = {
982+
targetNodes: [
983+
{
984+
target: {
985+
id: 1,
986+
agent: true,
987+
alias: 'Fake Target',
988+
connectUrl: 'http://fake-target.local:1234',
989+
jvmId: '1234',
990+
heapDumps: {
991+
data: [],
992+
aggregate: {
993+
count: 0,
994+
},
995+
},
996+
},
997+
},
998+
],
999+
};
1000+
break;
1001+
case 'AllTargetsThreadDumps':
1002+
case 'ThreadDumpCountForTarget':
1003+
case 'ThreadDumpsForTarget':
1004+
data = {
1005+
targetNodes: [
1006+
{
1007+
target: {
1008+
id: 1,
1009+
agent: true,
1010+
alias: 'Fake Target',
1011+
connectUrl: 'http://fake-target.local:1234',
1012+
jvmId: '1234',
1013+
threadDumps: {
1014+
data: [],
1015+
aggregate: { count: 0 },
1016+
},
1017+
},
1018+
},
1019+
],
1020+
};
1021+
break;
9781022
default: {
9791023
const msg = `${JSON.stringify(request.url)} (query: '${name}') currently unsupported in demo`;
9801024
console.error(msg);
@@ -986,6 +1030,17 @@ export const startMirage = ({ environment = 'development' } = {}) => {
9861030
this.get('api/v4/tls/certs', () => {
9871031
return new Response(200, {}, ['/truststore/additional-app.crt']);
9881032
});
1033+
this.get('api/beta/diagnostics/targets/:targetId/threaddump', () => []);
1034+
this.get('api/beta/diagnostics/targets/:targetId/heapdump', () => []);
1035+
this.post('api/beta/diagnostics/targets/:targetId/threaddump', () => {
1036+
return new Response(400, {}, 'Unsupported in Demo');
1037+
});
1038+
this.post('api/beta/diagnostics/targets/:targetId/heapdump', () => {
1039+
return new Response(400, {}, 'Unsupported in Demo');
1040+
});
1041+
this.post('api/beta/diagnostics/targets/:targetId/gc', () => {
1042+
return new Response(400, {}, 'Unsupported in Demo');
1043+
});
9891044
},
9901045
});
9911046
};

0 commit comments

Comments
 (0)