(config, path, body)
| 613 | } |
| 614 | |
| 615 | async function studioJson(config, path, body) { |
| 616 | const response = await fetch(`${config.studioUrl}${path}`, { |
| 617 | body: JSON.stringify(body), |
| 618 | headers: { "content-type": "application/json" }, |
| 619 | method: "POST", |
| 620 | }); |
| 621 | if (!response.ok) { |
| 622 | const message = await response.text().catch(() => ""); |
| 623 | throw new Error( |
| 624 | `Studio request ${path} failed: HTTP ${response.status}${message ? `: ${message}` : ""}`, |
| 625 | ); |
| 626 | } |
| 627 | return response.json(); |
| 628 | } |
| 629 | |
| 630 | async function loadConfig(args) { |
| 631 | const configPath = args["config"] || defaultConfigPath; |
no test coverage detected