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