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

Function httpsGet

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

Source from the content-addressed store, hash-verified

217// ---------------------------------------------------------------------------
218
219function httpsGet(
220 url: string,
221 headers: Record<string, string>,
222 timeoutMs: number
223): Promise<{ status: number; headers: Record<string, string | string[] | undefined>; body: string }> {
224 return new Promise((resolve, reject) => {
225 const req = https.get(url, { headers }, (res) => {
226 let body = '';
227 res.on('data', (c) => (body += c));
228 res.on('end', () => resolve({ status: res.statusCode ?? 0, headers: res.headers, body }));
229 });
230 req.on('error', reject);
231 req.setTimeout(timeoutMs, () => req.destroy(new Error(`request timed out after ${timeoutMs}ms`)));
232 });
233}
234
235/**
236 * 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