When running the script below from the GAS environment, I get the error message: "Attribute provided with invalid value: Header:Host"
function fetch() {var settings = {"async": true,"crossDomain": true,"method": "GET","headers": {"Authorization": "Bearer "+token,"User-Agent": "PostmanRuntime/7.20.1","Accept": "*/*","Cache-Control": "no-cache","Postman-Token": postman_token,"Host": "rest.tsheets.com","Accept-Encoding": "gzip, deflate","Connection": "keep-alive","cache-control": "no-cache"
}
}
var now = new Date();
var day = now.getDate()>9? now.getDate():'0'+now.getDate();
var date = now.getFullYear()+'-'+now.getMonth()+'-'+day;
var url = organization+'/timesheets?start_date='+date;
Logger.log(url);
var response = UrlFetchApp.fetch(url,settings);
Logger.log(response);
}
The original code was generated using Postman and works with no issues but I translated it from AJAX syntax to GAS and it doesn't work from the GAS environment.