在API网关中,您可以在方法的方法请求设置下指定要转发的HTTP请求头。我目前在通过put_rest_api应用编程接口网关客户端导入的Swagger规范文档中设置了一个必需的名称Authorization。它可以很好地导入到API Gateway中,如下所示。
parameters: [{
"in": "header",
"name": "Authorization",
"type": "string",
"required": true
}]
但是我还需要通过方法的集成请求设置一个HTTP标头映射
在使用Swagger规范文档的x-amazon-apigateway-integration
对象时,有没有办法指定这一点?我尝试了下面这样的方法,但是我得到了一个错误消息。
requestParameters: {
"integration.request.header.authorization" => "method.request.header.authorization"
}
errors : [Invalid mapping expression parameter specified: method.request.header.authorization]
发布于 2019-10-25 17:06:17
看起来名字是区分大小写的。将其更改为与参数对象的名称相匹配,就可以在API Gateway中导入和设置它。
"integration.request.header.Authorization": "method.request.header.Authorization"
https://stackoverflow.com/questions/58562741
复制