MCPcopy Index your code
hub / github.com/github/copilot-sdk / createProxy

Function createProxy

test/harness/replayingCapiProxy.test.ts:37–69  ·  view source on GitHub ↗
(
    httpExchanges: Array<{
      url: string;
      requestBody: string;
      responseBody: string;
    }>,
    options?: { toolResultNormalizers?: ToolResultNormalizer[] },
  )

Source from the content-addressed store, hash-verified

35 });
36
37 async function createProxy(
38 httpExchanges: Array<{
39 url: string;
40 requestBody: string;
41 responseBody: string;
42 }>,
43 options?: { toolResultNormalizers?: ToolResultNormalizer[] },
44 ) {
45 const outputPath = path.join(tempDir, "output.yaml");
46 const proxy = new ReplayingCapiProxy(
47 "http://localhost",
48 outputPath,
49 workDir,
50 );
51
52 for (const normalizer of options?.toolResultNormalizers ?? []) {
53 proxy.addToolResultNormalizer(normalizer.toolName, normalizer.normalizer);
54 }
55
56 for (const exchange of httpExchanges) {
57 (proxy.exchanges as Array<unknown>).push({
58 request: {
59 url: exchange.url,
60 method: "POST",
61 body: exchange.requestBody,
62 },
63 response: { statusCode: 200, body: exchange.responseBody },
64 });
65 }
66
67 await proxy.stop();
68 return outputPath;
69 }
70
71 async function readYamlOutput(outputPath: string): Promise<NormalizedData> {
72 const content = await readFile(outputPath, "utf-8");

Callers 1

Calls 4

stopMethod · 0.95
joinMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…