(config, path)
| 580 | } |
| 581 | |
| 582 | async function localGet(config, path) { |
| 583 | const target = new URL(path, `${config.localUrl}/`); |
| 584 | target.searchParams.set("simdeckToken", config.localToken); |
| 585 | const response = await fetch(target, { |
| 586 | headers: { "x-simdeck-token": config.localToken }, |
| 587 | }); |
| 588 | if (!response.ok) { |
| 589 | throw new Error( |
| 590 | `Local SimDeck GET ${path} failed: HTTP ${response.status}`, |
| 591 | ); |
| 592 | } |
| 593 | return response.json(); |
| 594 | } |
| 595 | |
| 596 | async function localJson(config, path, body) { |
| 597 | const target = new URL(path, `${config.localUrl}/`); |
no test coverage detected