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

Function api

test/skill-e2e-sidebar.test.ts:37–46  ·  view source on GitHub ↗
(pathname: string, opts: RequestInit = {})

Source from the content-addressed store, hash-verified

35 let queueFile: string = '';
36
37 async function api(pathname: string, opts: RequestInit = {}): Promise<Response> {
38 const headers: Record<string, string> = {
39 'Content-Type': 'application/json',
40 ...(opts.headers as Record<string, string> || {}),
41 };
42 if (!headers['Authorization'] && authToken) {
43 headers['Authorization'] = `Bearer ${authToken}`;
44 }
45 return fetch(`http://127.0.0.1:${serverPort}${pathname}`, { ...opts, headers });
46 }
47
48 beforeAll(async () => {
49 tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'sidebar-e2e-url-'));

Callers 1

Calls 1

fetchFunction · 0.70

Tested by

no test coverage detected