MCPcopy Create free account
hub / github.com/Superflows-AI/superflows / buildBody

Function buildBody

lib/edge-runtime/requests.ts:220–238  ·  view source on GitHub ↗
(
  schema: OpenAPIV3.SchemaObject,
  parameters: Record<string, unknown>,
)

Source from the content-addressed store, hash-verified

218}
219
220function buildBody(
221 schema: OpenAPIV3.SchemaObject,
222 parameters: Record<string, unknown>,
223): { [x: string]: any } {
224 const properties = schema.properties as {
225 [name: string]: OpenAPIV3_1.SchemaObject;
226 };
227 console.log("properties:", JSON.stringify(properties));
228
229 const bodyArray = Object.entries(properties).map(([name, property]) => {
230 // Throw out readonly attributes
231 if (property.readOnly) return undefined;
232 const paramValue = getParam(parameters, name);
233 if (paramValue) {
234 return { [name]: paramValue };
235 }
236 });
237 return Object.assign({}, ...bodyArray);
238}
239
240export async function makeHttpRequest(
241 url: string,

Callers 1

constructHttpRequestFunction · 0.70

Calls 1

getParamFunction · 0.90

Tested by

no test coverage detected