【发布时间】:2020-12-10 18:39:52
【问题描述】:
我正在尝试在无服务器上使用此插件:- serverless-apigateway-service-proxy,我想创建一个接受 x-www-form-urlencoded 请求并返回 xml 正文的 apiGatewayService 代理。我可以通过以下方式完成所有这些工作:
- sqs:
path: /testing-sqs
method: post
queueName: { "Fn::GetAtt": ["MySpecialQueue", "QueueName"] }
request:
template:
application/x-www-form-urlencoded: ${file(VTL/request.vtl)}
response:
- statusCode: 200
selectionPattern: '2\d{2}'
responseTemplates:
application/xml: |-
#set($inputRoot = $input.path('$'))
但是,当我在 postman 或 API Gateway 上进行测试时,响应内容类型标头是 application/json。通过将集成响应方法模型设置为:application/xml => Empty,我可以在 API Gateway 中手动更改此设置。
https://i.stack.imgur.com/cU7kI.png
如何在我的 serverless.yml 中指定集成响应模型,而不必在 API Gateway 中手动执行?
【问题讨论】:
标签: amazon-web-services yaml aws-api-gateway amazon-sqs serverless