如何避免在Google-Sheet应用程序脚本中重定向

问题描述 投票:0回答:1

我创建了一个Google Sheet App脚本,并以Web应用程序出版。 enter image description hereHttps://script.google.com/macros/s/akfycbyquxinw93wmwpouxb7nojt2886fbj6hbkgg9smf1b4rmn0i1xfg/exec

当我尝试将数据发布到此URL时,它是重定向到另一个URL的。 我如何避免此重定向。?

不使用

Contentservice

。如果您正在使用
google-apps-script web-applications
1个回答
4
投票
来返回JSON数据。它将重定向到另一个URL。这就是为什么您得到302回复的原因。

return ContentService.createTextOutput(JSON.stringify(result)) .setMimeType(ContentService.MimeType.JSON); https://developers.google.com/apps-script/guides/content#redirects

	

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.