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

Function localJson

scripts/studio-provider-bridge.mjs:616–636  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

614}
615
616async function localJson(path) {
617 const target = new URL(path, `${localUrl}/`);
618 target.searchParams.set("simdeckToken", localToken);
619 let response;
620 try {
621 response = await fetch(target, {
622 headers: { "x-simdeck-token": localToken },
623 signal: AbortSignal.timeout(Math.min(proxyTimeoutMs, 5000)),
624 });
625 } catch (error) {
626 throw new Error(`Local SimDeck request ${target.origin}${path} failed`, {
627 cause: error,
628 });
629 }
630 if (!response.ok) {
631 throw new Error(
632 `${target.href} failed with ${response.status}: ${await response.text()}`,
633 );
634 }
635 return response.json();
636}
637
638async function complete(payload) {
639 await fetchJson(`${cloudUrl}/api/actions/providers/rpc/complete`, {

Callers 1

localProviderMetadataFunction · 0.70

Calls 4

fetchFunction · 0.85
setMethod · 0.80
jsonMethod · 0.80
textMethod · 0.65

Tested by

no test coverage detected