Gro*_*ify 8 amazon-web-services query-string aws-api-gateway x-www-form-urlencoded
POST当使用正文中的 和其他参数发出请求时,许多服务可以接受 URL 中的查询字符串参数Content-Type: application/x-www-form-urlencoded,但 AWS API Gateway 似乎不能同时接受查询字符串参数。
POST当我使用映射模板和查询字符串 URL 参数(使用 Lambda 函数)调用 AWS API Gateway 时application/x-www-form-urlencoded,出现以下错误:
{
"message":"When Content-Type:application/x-www-form-urlencoded,
URL cannot include query-string parameters (after '?'):
'/prod/webhook?inputType=wootric&outputType=glip&url=...'"
}
Run Code Online (Sandbox Code Playgroud)
下面是一个 cURL 示例:
curl -XPOST 'https://{myid}.execute-api.{myregion}.amazonaws.com/prod/webhook? \
inputType=wootric&outputType=glip&url=https://hooks.glip.com/webhook/ \
11112222-3333-4444-5555-666677778888' \
-d "@docs/handlers/wootric/event-example_response-created.txt" \
-H 'Content-Type: application/x-www-form-urlencoded' -v
Run Code Online (Sandbox Code Playgroud)
具体目标是使用带有查询字符串参数的 URL 将 Wootric Webhook 事件发布到 Lambda 函数。
您可以在这里获取代码:
https://github.com/grokify/chathooks
Woodric 事件正文文件位于此处:
GitHub问题在这里:
https://github.com/grokify/chathooks/issues/15
错误消息似乎很明确,但我想问:
如果没有解决方案,除了部署像 Heroku 这样的托管服务器解决方案之外,是否还有一个好的轻量级解决方案。另外,其他云服务是否通过 API 网关 + 云功能支持此功能,例如 Google?
一些显示对两者支持的示例:
小智 -2
请将 HttpURLConnection 的请求属性设置为“Content-Type”、“application/json”,如下所示 connection.setRequestProperty("Content-Type", "application/json");
| 归档时间: |
|
| 查看次数: |
11323 次 |
| 最近记录: |