Ste*_*ath 4 json transform amazon-web-services aws-lambda aws-api-gateway
通过AWS API Gateway控制台执行测试时,我看到Lambda函数的输出响应已正确转换:
{
"type" : "",
"message" : "",
"request-id" : ""
}
Run Code Online (Sandbox Code Playgroud)
请参阅以下日志:
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
Run Code Online (Sandbox Code Playgroud)
但是,通过带有标题的Postman调用API时:
Content-Type : application/json
Accept : application/json
Run Code Online (Sandbox Code Playgroud)
没有输出转换发生,并且输出JSON消息只是:
{
"errorMessage": "501stef"
}
Run Code Online (Sandbox Code Playgroud)
部分与Amazon APi网关相关的网关无法生成转换后的请求,但此部分讨论了Request。
| 归档时间: |
|
| 查看次数: |
3866 次 |
| 最近记录: |