MCPcopy Create free account
hub / github.com/CopilotKit/aimock / httpPost

Function httpPost

src/__tests__/stream-usage.test.ts:29–52  ·  view source on GitHub ↗
(url: string, body: object)

Source from the content-addressed store, hash-verified

27}
28
29async function httpPost(url: string, body: object): Promise<{ status: number; body: string }> {
30 return new Promise((resolve, reject) => {
31 const req = http.request(
32 url,
33 {
34 method: "POST",
35 headers: { "Content-Type": "application/json" },
36 },
37 (res) => {
38 const chunks: Buffer[] = [];
39 res.on("data", (c) => chunks.push(c));
40 res.on("end", () =>
41 resolve({
42 status: res.statusCode!,
43 body: Buffer.concat(chunks).toString(),
44 }),
45 );
46 },
47 );
48 req.on("error", reject);
49 req.write(JSON.stringify(body));
50 req.end();
51 });
52}
53
54// ---------------------------------------------------------------------------
55// Tests

Callers 1

Calls 4

resolveFunction · 0.85
onMethod · 0.80
writeMethod · 0.80
endMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…