API网关使用输入直通无服务器1.x配置http集成

时间:2017-12-28 16:03:37

标签: amazon-web-services aws-api-gateway serverless-framework

有没有办法将所有参数,标题和正文映射到另一个http端点?它需要一个特殊的模板吗?

这是我到目前为止所得到的:

functions:
  myfunction:
    handler: lambda.myfunction # dummy hanlder
    events:    
      - http:
          path: resource/{resourceId}/other
          method: get
          integration: HTTP
          request:
            uri: http://url/resource/{resourceId}/other
            parameters:
              'method.request.path.resourceId': true
              'method.request.header.my-header': true
          response:
            statusCodes:
              200:
                pattern: ''

每当我在控制台中直接创建时,默认情况下会启用直通选项,并正确映射resourceId

我试着查看文档但看起来几乎没有关于http集成的文档,除非我遗漏了一些东西。

2 个答案:

答案 0 :(得分:1)

  

有没有办法将所有参数,标题和正文映射到另一个http端点?它需要一个特殊的模板吗?

是的,使用HTTP_PROXY集成类型。在控制台中,这是“集成请求”页面中的复选框。

答案 1 :(得分:0)

我能够找到一种解决方法来使其工作,似乎比正确的解决方案更具解决方法。

我必须在serverless.yml的资源中设置<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <section class="strand"> <ol> <li> <h3> Bavaro Beach</h3> <br> </li> <li> <h3> Macao Beach</h3> <br> </li> <li> <h3> Bayahibe Beach</h3> <br> </li> <li> <h3> Saona</h3> <br> </li> </ol> </section>才能实现此目的。

Integration.RequestParameters