MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / localJson

Function localJson

scripts/studio-host-provider.mjs:596–613  ·  view source on GitHub ↗
(config, path, body)

Source from the content-addressed store, hash-verified

594}
595
596async 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
615async function studioJson(config, path, body) {
616 const response = await fetch(`${config.studioUrl}${path}`, {

Callers 3

allocateSessionFunction · 0.70
releaseSessionFunction · 0.70
bootSimulatorFunction · 0.70

Calls 3

fetchFunction · 0.85
setMethod · 0.80
jsonMethod · 0.80

Tested by

no test coverage detected