MCPcopy
hub / github.com/garrytan/gstack / batch

Function batch

browse/test/batch.test.ts:18–28  ·  view source on GitHub ↗
(commands: any[], opts: { timeout?: number; stream?: boolean } = {})

Source from the content-addressed store, hash-verified

16
17// Helper to send batch requests to the browse server
18async function batch(commands: any[], opts: { timeout?: number; stream?: boolean } = {}): Promise<any> {
19 const res = await fetch(`http://127.0.0.1:${serverPort}/batch`, {
20 method: 'POST',
21 headers: { 'Content-Type': 'application/json' },
22 body: JSON.stringify({ commands, ...opts }),
23 });
24 if (opts.stream) {
25 return res; // return raw response for SSE testing
26 }
27 return res.json();
28}
29
30beforeAll(async () => {
31 testServer = startTestServer(0);

Callers

nothing calls this directly

Calls 1

fetchFunction · 0.70

Tested by

no test coverage detected