(function () {
const __javy_fetchio_request = globalThis.__javy_fetchio_request;
function fetch(url, options = {}) {
const parsedOptions = JSON.stringify(options)
const responseObj = __javy_fetchio_request(url, parsedOptions);
const responseOk = responseObj.ok;
const responseHeaders = {};
const responseBody = responseObj.body;
return new Promise((resolve, reject) => {
const response = {
url,
headers: responseHeaders,
ok: responseOk,
type: typeof responseBody === 'string' ? 'text' : 'json',
text: () => typeof responseBody === 'string' ? responseBody : JSON.stringify(responseBody),
json: () => typeof responseBody !== 'string' ? responseBody : JSON.parse(responseBody),
};
resolve(response);
});
}
globalThis.fetch = fetch
Reflect.deleteProperty(globalThis, "__javy_fetchio_request");
})();