Last active
January 28, 2021 04:49
-
-
Save rezonn/71a1c73f4e981589c36ccd759aa2420d to your computer and use it in GitHub Desktop.
Google Apps Script polyfills
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fetch(url,options2) { | |
if (options2) { | |
if (options2.body) { | |
options2.payload = options2.body.toString("binary"); | |
options2.body = undefined; | |
} | |
} | |
return new Promise(function (resolve, reject) { | |
try { | |
var data = UrlFetchApp.fetch(url, options2); | |
} catch(e) {console.log(e.message)} | |
resolve({ | |
headers:data.headers, | |
text:function(){return data.getContentText()} | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment