Amazon web services Can';t在serverless.yml apiGatewayServiceProxies中指定响应头

Amazon web services Can';t在serverless.yml apiGatewayServiceProxies中指定响应头,amazon-web-services,yaml,aws-api-gateway,amazon-sqs,serverless,Amazon Web Services,Yaml,Aws Api Gateway,Amazon Sqs,Serverless,我正在尝试在serverless:-serverless apigateway服务代理上使用此插件,我希望创建一个apiGatewayService代理,它接受x-www-form-urlencoded请求并返回xml正文。我可以通过以下方式完成所有这些工作: - sqs: path: /testing-sqs method: post queueName: { "Fn::GetAtt": ["MySpecia

我正在尝试在serverless:-serverless apigateway服务代理上使用此插件,我希望创建一个apiGatewayService代理,它接受x-www-form-urlencoded请求并返回xml正文。我可以通过以下方式完成所有这些工作:

    - 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网关上测试时,响应内容类型头是application/json。通过将集成响应方法模型设置为:application/xml=>Empty,我可以在API网关中手动更改这一点


如何在我的serverless.yml中指定集成响应模型,而不必在API Gateway中手动执行?

因此,似乎没有办法通过我可以找到的responseParameters执行此操作。但是,我可以通过使用映射模板覆盖标头使其正常工作:

          - statusCode: 200
            selectionPattern: '2\d{2}'
            responseTemplates:
              application/xml: |-
                #set($inputRoot = $input.path('$'))
                #set($context.responseOverride.header.Content-Type = 'application/xml')

因此,似乎没有办法通过我可以找到的responseParameters来实现这一点,但是,我能够通过使用映射模板覆盖标头来实现这一点:

          - statusCode: 200
            selectionPattern: '2\d{2}'
            responseTemplates:
              application/xml: |-
                #set($inputRoot = $input.path('$'))
                #set($context.responseOverride.header.Content-Type = 'application/xml')