MCPcopy Create free account
hub / github.com/github/copilot-sdk / makeRequest

Function makeRequest

test/harness/replayingCapiProxy.test.ts:618–650  ·  view source on GitHub ↗
(
      proxyUrl: string,
      requestPath: string,
      options?: { method?: string; body?: object },
    )

Source from the content-addressed store, hash-verified

616
617 describe("cache replay", () => {
618 async function makeRequest(
619 proxyUrl: string,
620 requestPath: string,
621 options?: { method?: string; body?: object },
622 ): Promise<{ status: number; body: string }> {
623 return new Promise((resolve, reject) => {
624 const url = new URL(proxyUrl);
625 const req = http.request(
626 {
627 hostname: url.hostname,
628 port: url.port,
629 path: requestPath,
630 method: options?.method ?? "POST",
631 headers: { "content-type": "application/json" },
632 },
633 (res) => {
634 const chunks: Buffer[] = [];
635 res.on("data", (chunk: Buffer) => chunks.push(chunk));
636 res.on("end", () => {
637 resolve({
638 status: res.statusCode || 500,
639 body: Buffer.concat(chunks).toString("utf-8"),
640 });
641 });
642 },
643 );
644 req.on("error", reject);
645 if (options?.body) {
646 req.write(JSON.stringify(options.body));
647 }
648 req.end();
649 });
650 }
651
652 test("returns cached response when request matches prefix", async () => {
653 const cachePath = path.join(tempDir, "cache.yaml");

Callers 1

Calls 6

toStringMethod · 0.80
requestMethod · 0.45
onMethod · 0.45
pushMethod · 0.45
writeMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…