HTTP support in scripts

Hi together.

This is a short description about an experimental feature:

The PR for this feature adds very basic HTTP support to scripting, you can use the getJSON request to call other APIs:

// Set async to true to indicate the script engine to wait for explicit calls of `replace()` or `complete()`.
async = true;

getJSON('https://jsonplaceholder.typicode.com/todos/1', response => {
    ctx.data.title.iv = response.title;
    
    replace();
});

There is also an overload with headers

var headers = {
  Authentication: 'abc'
};

getJSON('https://jsonplaceholder.typicode.com/todos/1', response => {
    ctx.data.title.iv = response.title;
    
    replace();
}, headers );

I also made the scripting more extensible:

1 Like