小编Sub*_*ham的帖子

HttpApi 与 AWS::ApiGatewayV2::integration 如何覆盖响应正文

我想覆盖从此集成发送的响应正文。我指的是这个链接https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-parameter-mapping.html

它说要使用overwrite:$response.body. 但这不起作用。我给出错误说“无效的目标参数”

APIVersionIntegration:
  Type: AWS::ApiGatewayV2::Integration
  Properties:
    ApiId: !Ref HttpApi
    ConnectionType: INTERNET
    CredentialsArn: !GetAtt MyHttpApiRole.Arn
    IntegrationType: AWS_PROXY
    RequestParameters:
      MessageBody: "$request.body"
      QueueUrl: !Ref DataPublisherSQS
    ResponseParameters:
      "200":
        ResponseParameters:
          - Source: "application/json"
            Destination: "overwrite:header.content-type"
          - Source: ""
            Destination: "overwrite:$response.body"
    IntegrationSubtype: "SQS-SendMessage"
    # IntegrationMethod: POST
    PayloadFormatVersion: "1.0"
Run Code Online (Sandbox Code Playgroud)

amazon-web-services aws-cloudformation aws-api-gateway

5
推荐指数
1
解决办法
439
查看次数