feat(scripts): add fetch-http script for HTTP requests

Introduce a new fetch-http script that facilitates making HTTP requests with configurable methods, headers, and body. The script includes validation for input parameters and logs the request and response details. This addition enhances the server's capability to interact with external APIs and services.
This commit is contained in:
2026-08-15 17:09:28 +07:00
parent 46e2cbb83b
commit 94ba931d9b
3 changed files with 164 additions and 6 deletions
+2 -2
View File
@@ -1,10 +1,10 @@
import jsonata from "jsonata";
function jsonataFn(ctx) {
async function jsonataFn(ctx) {
log.info({ctx}, "jsonata: context")
log.info("jsonata: evaluating expression %s", ctx.config.expression);
const expression = jsonata(ctx.config.expression);
const result = expression.evaluate(ctx.data);
const result = await expression.evaluate(ctx.data);
log.info({result}, "jsonata: expression result");
return result;
}