发布到 Google 脚本时如何修复 "HTTP 405"?
How to fix "HTTP 405" when posting to a Google Script?
我正在尝试从 ROBLOX 服务器向 Google 脚本发出 post 请求,但出现 "HTTP 405" 错误。它在 Postman(我用来测试 HTTP Post 请求的软件)中工作正常,但是当我从 ROBLOX 服务器 post 时,我收到 HTTP 405 错误。我该怎么做才能解决这个问题?
Google 脚本代码
function doPost(e) {
Logger.log("running");
handleFunction(e.parameter);
return ContentService.createTextOutput(JSON.stringify(e));
}
ROBLOX代码
return function(args)
pcall(function()
--Get the timestamp
args.Time = os.date("!*t").year .. ":" .. os.date("!*t").month .. ":" .. os.date("!*t").day .. " " .. os.date("!*t").hour .. ":" .. os.date("!*t").min .. ":" .. os.date("!*t").sec;
args = HttpService:JSONEncode(args);
HttpService:PostAsync(dbScript,args);
end);
end;
基于此 forum,可能 Google 禁止 roblox 向 google 表发送数据,因为它可能被其他人滥用。也尝试将您复制到 Roblox 模块中的 URL 放入您的浏览器中。 从脚本编辑器发布 -> 部署为 Web 应用应该会列出您当前的 URL。如果他们禁止 Roblox 的服务器,这将起作用。
我正在尝试从 ROBLOX 服务器向 Google 脚本发出 post 请求,但出现 "HTTP 405" 错误。它在 Postman(我用来测试 HTTP Post 请求的软件)中工作正常,但是当我从 ROBLOX 服务器 post 时,我收到 HTTP 405 错误。我该怎么做才能解决这个问题?
Google 脚本代码
function doPost(e) {
Logger.log("running");
handleFunction(e.parameter);
return ContentService.createTextOutput(JSON.stringify(e));
}
ROBLOX代码
return function(args)
pcall(function()
--Get the timestamp
args.Time = os.date("!*t").year .. ":" .. os.date("!*t").month .. ":" .. os.date("!*t").day .. " " .. os.date("!*t").hour .. ":" .. os.date("!*t").min .. ":" .. os.date("!*t").sec;
args = HttpService:JSONEncode(args);
HttpService:PostAsync(dbScript,args);
end);
end;
基于此 forum,可能 Google 禁止 roblox 向 google 表发送数据,因为它可能被其他人滥用。也尝试将您复制到 Roblox 模块中的 URL 放入您的浏览器中。 从脚本编辑器发布 -> 部署为 Web 应用应该会列出您当前的 URL。如果他们禁止 Roblox 的服务器,这将起作用。