json - Amazon API Gateway : response body is not transformed when the API is called via Postman?

标签 json amazon-web-services transform aws-lambda aws-api-gateway

通过AWS API Gateway控制台执行测试时,我看到Lambda函数的输出响应已正确转换:

{
  "type" : "",
  "message" : "",
  "request-id" : ""
}

请参阅以下日志:
Tue Sep 06 14:46:06 UTC 2016 : Endpoint request body after transformations: {}
Tue Sep 06 14:46:06 UTC 2016 : Endpoint response body before transformations: {"errorMessage":"501stef"}
Tue Sep 06 14:46:06 UTC 2016 : Endpoint response headers: {x-amzn-Remapped-Content-Length=0, x-amzn-RequestId=a4540f42-7440-11e6-90ce-214b29fcde38, Connection=keep-alive, Content-Length=26, Date=Tue, 06 Sep 2016 14:46:06 GMT, Content-Type=application/json}
Tue Sep 06 14:46:06 UTC 2016 : Method response body after transformations: {
  "type" : "",
  "message" : "",
  "request-id" : ""
}
Tue Sep 06 14:46:06 UTC 2016 : Method response headers: {Content-Type=application/json}
Tue Sep 06 14:46:06 UTC 2016 : Successfully completed execution
Tue Sep 06 14:46:06 UTC 2016 : Method completed with status: 501



但是,通过带有标题的Postman调用API时:
Content-Type : application/json
Accept : application/json

enter image description here

没有输出转换发生,并且输出JSON消息只是:
{
  "errorMessage": "501stef"
}

Amazon APi gateway fails to generate transformed request部分相关,但是这一部分讨论了请求

最佳答案

在外部看不到更改之前,您需要部署API !

enter image description here
**enter image description here**

关于json - Amazon API Gateway : response body is not transformed when the API is called via Postman?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39352240/

相关文章:

javascript - 在 Rails 中创建 JSON 对象,然后使用 jQuery/Ajax 从操作中获取 JSON 的正确方法是什么?

python-3.x - 如何找出S3 Bucket上次访问的时间?

CSS transform div 一切都保持旋转

python - pandas dataframe groupby 并填充第一行值

css - 如何创建外侧为圆边、内侧为斜边的切换按钮?

javascript - 从对象中获取元素并与数组进行比较 - Jquery

javascript - 将 php 数组从外部 php 文件传递​​给 javascript 函数

javascript - 我如何检查加载页面时是否加载了 .json 文件

amazon-web-services - 自定义资源支持的 Lambda 永远为 "CREATE_IN_PROGRESS"

hadoop - 减少许多 hive -e 调用的 hive 启动时间