MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / request

Function request

__tests__/ui-events-api.test.ts:41–67  ·  view source on GitHub ↗
(requestPath: string)

Source from the content-addressed store, hash-verified

39`;
40
41function request(requestPath: string): Promise<{ status: number; body: string; type?: string }> {
42 return new Promise((resolve, reject) => {
43 const req = http.request(
44 {
45 host: '127.0.0.1',
46 port: server.port,
47 path: requestPath,
48 method: 'GET',
49 headers: { Host: `127.0.0.1:${server.port}` },
50 setHost: false,
51 },
52 (res) => {
53 const chunks: Buffer[] = [];
54 res.on('data', (c: Buffer) => chunks.push(c));
55 res.on('end', () =>
56 resolve({
57 status: res.statusCode ?? 0,
58 body: Buffer.concat(chunks).toString('utf-8'),
59 type: res.headers['content-type'],
60 })
61 );
62 }
63 );
64 req.on('error', reject);
65 req.end();
66 });
67}
68
69interface SseEvent {
70 event: string;

Callers 1

Calls 4

pushMethod · 0.80
resolveFunction · 0.70
requestMethod · 0.65
onMethod · 0.65

Tested by

no test coverage detected