UrlFetchApp doGet未被调用,并通过“Meet Google Drive”返回HTML [英] UrlFetchApp doGet not called and return html with "Meet Google Drive"

查看:114
本文介绍了UrlFetchApp doGet未被调用,并通过“Meet Google Drive”返回HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一定会放松我的想法,因为突然之间我可以让一个简单的webapp工作。
当我使用在浏览器中生成的url时,一切正常。当我运行脚本时,结果是使用Meet Google云端硬盘的HTML内容。



以下是代码:

<$ (){
return ContentService.createTextOutput('blabla')。setMimeType(ContentService.MimeType.TEXT);
}

功能的客户端(){
变种URL =https://script.google.com/macros/s/AKfycby2NVrhG0O5fE6gTgage2QPYH3UJ2s23AJDLnB9YL69uyDFlmM/exec;
Logger.log(url);
var result = UrlFetchApp.fetch(url);
Logger.log(result);

$ / code>

doGet()和client()函数都在同一个文件中从来都不是问题。保存了一个版本,并将应用部署为任何访问该应用的用户,并以访问该应用的用户身份运行。 result.getContentText()返回相同的html输出。 result.getResponseCode()返回200应该成功,但我不能看到被调用的doGet()。



任何想法我错过了什么?



谢谢。

解决方案

我有同样的问题。
当您部署WebApp时,请确保授权设置为任何人,包括匿名!


I must be loosing my mind as suddenly I can'y get a simple webapp to work. When I use the url generated in the browser everything works fine. When I run the script the result is an html content with Meet Google Drive.

Here is the code:

function doGet(e) {
  return ContentService.createTextOutput('blabla').setMimeType(ContentService.MimeType.TEXT);  
}

function client() {
  var url = 'https://script.google.com/macros/s/AKfycby2NVrhG0O5fE6gTgage2QPYH3UJ2s23AJDLnB9YL69uyDFlmM/exec';
  Logger.log(url);
  var result = UrlFetchApp.fetch(url);
  Logger.log(result);
}

Both doGet() and the client() functions are at the same file which was never a problem. A version was saved and the app deployed as anyone accessing the app and run as user accessing the app. result.getContentText() returns the same html output. result.getResponseCode() return 200 which supposed to be successful however I can't see the doGet() being called.

Any idea what I missed?

Thanks.

解决方案

I had the same issue. When you deploy the WebApp, make sure the authorizations are set to "Anyone, including Anonymous"!

这篇关于UrlFetchApp doGet未被调用,并通过“Meet Google Drive”返回HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆