(path, init = {})
| 11 | const headers = { authorization: `Bearer ${token}`, "content-type": "application/json" }; |
| 12 | |
| 13 | async 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 | } |
| 19 | async function createDesktopRun() { |
| 20 | let last; |
| 21 | for (let attempt = 1; attempt <= 3; attempt++) { |
no test coverage detected