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

Function httpsGet

src/upgrade/index.ts:299–313  ·  view source on GitHub ↗
(
  url: string,
  headers: Record<string, string>,
  timeoutMs: number
)

Source from the content-addressed store, hash-verified

297// ---------------------------------------------------------------------------
298
299function httpsGet(
300 url: string,
301 headers: Record<string, string>,
302 timeoutMs: number
303): Promise<{ status: number; headers: Record<string, string | string[] | undefined>; body: string }> {
304 return new Promise((resolve, reject) => {
305 const req = https.get(url, { headers }, (res) => {
306 let body = '';
307 res.on('data', (c) => (body += c));
308 res.on('end', () => resolve({ status: res.statusCode ?? 0, headers: res.headers, body }));
309 });
310 req.on('error', reject);
311 req.setTimeout(timeoutMs, () => req.destroy(new Error(`request timed out after ${timeoutMs}ms`)));
312 });
313}
314
315/**
316 * Resolve the latest release tag (e.g. `v0.9.9`).

Callers 1

resolveLatestVersionFunction · 0.85

Calls 4

getMethod · 0.65
onMethod · 0.65
resolveFunction · 0.50
destroyMethod · 0.45

Tested by

no test coverage detected