amazon-web-services - 为什么 API Gateway 在发送到我的代理时没有替换我的路径变量?
问题描述
我希望它将我的请求发送到http://<removed>/search/qweqweqweqwe
,而不是http://<removed>/search/{searchString}
。我究竟做错了什么?
Mon May 06 13:18:59 UTC 2019 : HTTP Method: GET, Resource Path: /search/qweqweqweqwe
Mon May 06 13:18:59 UTC 2019 : Method request path: {searchString=qweqweqweqwe}
Mon May 06 13:18:59 UTC 2019 : Method request query string: {}
Mon May 06 13:18:59 UTC 2019 : Method request headers: {}
Mon May 06 13:18:59 UTC 2019 : Method request body before transformations:
Mon May 06 13:19:00 UTC 2019 : Endpoint request URI: http://<removed>/search/{searchString}
Mon May 06 13:19:00 UTC 2019 : Endpoint request headers: {x-amzn-apigateway-api-id=bx0tw55ts0, User-Agent=AmazonAPIGateway_bx0tw55ts0}
Mon May 06 13:19:00 UTC 2019 : Endpoint request body after transformations:
Mon May 06 13:19:00 UTC 2019 : Sending request to http://<removed>/search/{searchString}
解决方案
显然,如果您在 API Gateway 上使用 http_proxy,则必须在集成请求部分创建一个 URL 路径参数。一旦我添加searchString
为变量 and method.request.path.searchString
,它就会按预期工作。
现在我只需要弄清楚如何在 swagger api doc 中定义它并让它在导入时工作。
推荐阅读
- asp.net-web-api - MVC\WEB Api 默认路由应该在路由列表的底部?对吧?
- python - Django模型没有将日期字段转换为datetime.date?
- python - 使用 hvplot/holoviews 更改分组条形图中的条形顺序
- mysql - 如何解决 XAMPP PHPMyAdmin 403 禁止错误
- sql - 执行条件为假的 if 语句中的语句
- sql - 基于值的 SQL JOIN 表
- c - 使用 fscanf() 在 C 中进行加法和减法
- reactjs - 使用 React-Router v.5、useHistory、useSelector 和 useEffect 测试 React
- javascript - ExpressJS 应用服务器在多次请求后返回 502
- jenkins - 如何从配置文件执行詹金斯管道