我正在尝试使用 Google Cloud Tasks,通过“试用此 API”网络功能或 Ruby Google Cloud SDK 创建任务。
我无法将有效负载交付给工作人员。
将 Http 方法作为 POST 发送实际上有效,但在 Cloud Tasks UI 中显示为 GET。
没有负载或标头发送到工作人员或显示在 Cloud Task UI 中。我尝试过 Base64、JSON、普通字符串。(见下图)
例子:
要求:
{
"task": {
"httpRequest": {
"httpMethod": "POST",
"body": "SGVsbG8=",
"url": "https://some-random-url"
}
}
}
回复:
{
"name": "projects/<my-project>/locations/europe-west1/queues/default/tasks/73572672049866200001",
"scheduleTime": "2019-07-03T14:49:34.450453Z",
"createTime": "2019-07-03T14:49:34Z",
"view": "BASIC",
"httpRequest": {
"url": "https://some-random-url/",
"httpMethod": "POST",
"headers": {
"User-Agent": "Google-Cloud-Tasks"
}
},
"dispatchDeadline": "600s"
}
示例 Ruby 代码:
task = {
http_request: {
url: <project/location/queue/url>,
http_method: 'POST',
body: "Something"
}
}
response = @client.create_task(@parent, task)
谷歌云用户界面截图:
是否有一些特殊的格式来设置通过 POST 传递的有效负载?
谢谢!