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

Function httpsGet

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

Source from the content-addressed store, hash-verified

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