MCPcopy
hub / github.com/coder/mux / httpGet

Function httpGet

src/node/utils/oauthLoopbackServer.test.ts:16–28  ·  view source on GitHub ↗

Simple GET helper that returns { status, body }.

(url: string)

Source from the content-addressed store, hash-verified

14
15/** Simple GET helper that returns { status, body }. */
16async function httpGet(url: string): Promise<{ status: number; body: string }> {
17 return new Promise((resolve, reject) => {
18 http
19 .get(url, (res) => {
20 let body = "";
21 res.on("data", (chunk: Buffer) => {
22 body += chunk.toString();
23 });
24 res.on("end", () => resolve({ status: res.statusCode ?? 0, body }));
25 })
26 .on("error", reject);
27 });
28}
29
30// ---------------------------------------------------------------------------
31// Tests

Callers 1

Calls 3

onMethod · 0.80
getMethod · 0.65
resolveFunction · 0.50

Tested by

no test coverage detected