MCPcopy Create free account
hub / github.com/acoyfellow/cloudbox / request

Function request

scripts/proof-desktop-shell.mjs:13–18  ·  view source on GitHub ↗
(path, init = {})

Source from the content-addressed store, hash-verified

11const headers = { authorization: `Bearer ${token}`, "content-type": "application/json" };
12
13async function request(path, init = {}) {
14 const response = await fetch(`${url}${path}`, { ...init, headers });
15 const body = await response.json().catch(() => null);
16 if (!response.ok) throw Object.assign(new Error(`${init.method ?? "GET"} ${path} failed: ${response.status} ${JSON.stringify(body)}`), { status: response.status, body });
17 return body;
18}
19async function createDesktopRun() {
20 let last;
21 for (let attempt = 1; attempt <= 3; attempt++) {

Callers 1

createDesktopRunFunction · 0.70

Calls 1

fetchFunction · 0.50

Tested by

no test coverage detected