(config, path, body)
| 594 | } |
| 595 | |
| 596 | async function localJson(config, path, body) { |
| 597 | const target = new URL(path, `${config.localUrl}/`); |
| 598 | target.searchParams.set("simdeckToken", config.localToken); |
| 599 | const response = await fetch(target, { |
| 600 | body: JSON.stringify(body), |
| 601 | headers: { |
| 602 | "content-type": "application/json", |
| 603 | "x-simdeck-token": config.localToken, |
| 604 | }, |
| 605 | method: "POST", |
| 606 | }); |
| 607 | if (!response.ok) { |
| 608 | throw new Error( |
| 609 | `Local SimDeck POST ${path} failed: HTTP ${response.status}`, |
| 610 | ); |
| 611 | } |
| 612 | return response.json(); |
| 613 | } |
| 614 | |
| 615 | async function studioJson(config, path, body) { |
| 616 | const response = await fetch(`${config.studioUrl}${path}`, { |
no test coverage detected