【发布时间】:2020-08-22 01:32:26
【问题描述】:
我正在尝试使用 UrlFetchApp Google Scripts API 创建代理。但是,对于?url="https://google.com" 的查询字符串,它给了我这个错误:
Exception: Invalid argument: "https://google.com" (line 3, file "Code")
但是当我在下面的代码中将param 替换为https://google.com(param 的确切值)时,由于某种原因,它可以正常工作。
这是我的代码:
function doGet(e) {
var param = e["parameter"]["url"];
var response = UrlFetchApp.fetch(param);
return HtmlService.createHtmlOutput(response);
}
感谢您的帮助!
【问题讨论】:
-
e.parameter.url怎么样? -
@Cooper 当我这样做时,它会显示以下错误消息:
Exception: Attribute provided with no value: url (line 3, file "Code") -
问题是 Tanaike 指出的查询字符串中的引号
-
@Cooper 好的,谢谢。
标签: javascript html google-apps-script http-get urlfetch