Scriptlab自定义函数获取TypeError:进行GET api调用时,网络请求失败

问题描述

/**
 * Get Volume .
 * @customfunction
 * @param {string} companyId
 * @param {string} date
 */
async function getVolume(companyId,date) {
  //You can change this URL to any web request you want to work with.
  var myHeaders = new Headers();
  myHeaders.append(
    "Authorization","Bearer token_value"
  );
  var requestOptions = {
    method: "GET",headers: myHeaders
  };

  const url = `url value`;
  const response = await fetch(url,requestOptions);
  console.log(response);
  //Expect that status code is in 200-299 range
  if (!response.ok) {
    throw new Error(response.statusText);
  }
  const jsonResponse = await response.json();
  return jsonResponse;
}

当我使用邮递员发出请求时,它可以工作,但在excel scriptlab中出错。请任何人指导我解决此错误。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...