2022-04-03 16:42:12 +00:00
|
|
|
import fetch, {RequestInfo, RequestInit} from "node-fetch";
|
|
|
|
import {SysCallMapping} from "../system";
|
2022-03-25 11:03:06 +00:00
|
|
|
|
|
|
|
export function fetchSyscalls(): SysCallMapping {
|
|
|
|
return {
|
2022-04-03 16:42:12 +00:00
|
|
|
"fetch.json": async (ctx, url: RequestInfo, init: RequestInit) => {
|
2022-03-25 11:03:06 +00:00
|
|
|
let resp = await fetch(url, init);
|
|
|
|
return resp.json();
|
|
|
|
},
|
2022-04-03 16:42:12 +00:00
|
|
|
"fetch.text": async(ctx, url: RequestInfo, init: RequestInit) => {
|
2022-03-25 11:03:06 +00:00
|
|
|
let resp = await fetch(url, init);
|
|
|
|
return resp.text();
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|