【发布时间】:2020-04-01 15:33:50
【问题描述】:
如何配置 Swagger/APIGateway 以将响应 Header 属性 Content-Type 设置为“application/xml”,以便使用和生成 xml 的 APIGateway Lambda GET 端点?
目前响应的Header Content-Type值为“application/json”
我试图这样指定它:-
"/v1/XXXXXXX": {
"get": {
"produces": [
"application/xml"
],
"responses": {
"200": {
"description": "Meter reading data",
"schema": { ........ }
}
},
"x-amazon-apigateway-integration": {
"responses": {
"default": {
"statusCode": "200",
"responseParameters": {
"method.response.header.Content-Type": "'application/xml'"
}
}
}
}
错误如下:-
Errors found during import: Unable to put integration response on 'GET' for resource at path '/v1/XXXXXXXXX': Invalid mapping expression specified: Validation Result: warnings : [], errors : [Invalid mapping expression parameter specified: method.response.header.Content-Type]
非常感谢,
山姆
【问题讨论】: