【发布时间】:2016-05-15 16:28:17
【问题描述】:
我正在尝试在部署脚本中使用 aws-cli 从命令行设置 aws CORS。 我已经使用以下 perl to shell 命令创建了 POST 资源。 我正在尝试将集成响应设置为“*”,就像启用内核一样。
aws apigateway put-method-response \\
--region "$region" \\
--rest-api-id "$api_id" \\
--resource-id "$resource_id" \\
--http-method "POST" \\
--status-code 200 \\
--response-models '{"application/json":"Empty"}' \\
--response-parameters '{"method.response.header.Access-Control-Allow-Origin":true}'
当我运行以下命令来设置积分值时。
aws apigateway put-integration-response \\
--region "$region" \\
--rest-api-id "$api_id" \\
--resource-id "$resource_id" \\
--http-method "$method" \\
--status-code 200 \\
--response-template '{"application/json":"Empty"}' \\
--response-parameters \\
'{"method.response.header.Access-Control-Allow-Origin": "'*'"}'
我收到以下错误。
调用 PutIntegrationResponse 操作时发生客户端错误 (BadRequestException):指定的映射表达式无效:验证结果:警告:[],错误:[指定的映射表达式无效:*]
谁能告诉我这个错误到底指的是什么,甚至是更好的方法来处理 api 网关部署脚本。
【问题讨论】:
标签: json perl amazon-web-services aws-cli aws-api-gateway