obelisk 0.37.2

Deterministic workflow engine
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// testing:js/activity.fetch-get: func(url: string, headers: list<tuple<string,string>>) -> result<string, string>
export default async function fetch_get(url /* string */, headersArr /* list<tuple<string,string>> */) {
    let headers = Object.fromEntries(headersArr);
    console.info("Fetching", url, headers);
    const resp = await fetch(url, {
        headers
    });
    try {
        const text = await resp.text();
        return text;
    } catch (e) {
        throw new Error(e); // cast to string
    }
}