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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user