MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / postJson

Function postJson

scripts/agent-config-smoke.ts:119–130  ·  view source on GitHub ↗
(url: string, payload: unknown)

Source from the content-addressed store, hash-verified

117};
118
119const postJson = async (url: string, payload: unknown): Promise<unknown> => {
120 const response = await fetch(url, {
121 method: "POST",
122 headers: { "content-type": "application/json" },
123 body: JSON.stringify(payload),
124 });
125 const bodyText = await response.text();
126 if (!response.ok) {
127 throw new Error(`POST ${url} failed with HTTP ${response.status}: ${bodyText}`);
128 }
129 return bodyText.length > 0 ? JSON.parse(bodyText) : null;
130};
131
132const firstScope = (value: unknown): { readonly id: string; readonly name: string } => {
133 const data = toolData<{

Callers 1

Calls 2

textMethod · 0.65
fetchFunction · 0.50

Tested by

no test coverage detected