Amazon API Gateway:通过Postman调用API时,响应主体是否未转换? [英] Amazon API Gateway : response body is not transformed when the API is called via Postman?

查看:598
本文介绍了Amazon API Gateway:通过Postman调用API时,响应主体是否未转换?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

When executing a testvia the AWS API Gateway console, I see that the output response from the Lambda function is correctly transformed:

{
  "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时:

However when calling the API via Postman with headers:

Content-Type : application/json
Accept : application/json

没有进行任何输出转换,并且输出JSON消息仅为:

No output transformation is happening, and the output JSON message is just:

{
  "errorMessage": "501stef"
}


部分与> Amazon APi网关失败有关请求,但这是关于请求的问题.


Partly related to Amazon APi gateway fails to generate transformed request but this one talks about the Request.

推荐答案

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

Before the changes are externally visible, you need to Deploy the API !

这篇关于Amazon API Gateway:通过Postman调用API时,响应主体是否未转换?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆