我是 AWS 新手。我想将标头参数添加到我的 HTTP 请求中。我在 CloudShell 中尝试了以下命令,但它不起作用。
aws apigatewayv2 update-integration --integration-id xxx --api-id xxxxx --request-parameters 'integration.request.header.Some-Header-Param'= 'SomeText'
它给出以下错误:
An error occurred (BadRequestException) when calling the UpdateIntegration operation: Invalid mapping expression specified: Validation Result: warnings : [], errors : [Invalid mapping expression specified: SomeText]
搜索后,我从https://repost.aws/knowledge-center/api-gateway-vpc-link-integration
找到了答案aws apigatewayv2 get-integrations --api-id <api-id>
{ "ApiId": "<api-id>", "IntegrationId": "<integration id retrieved from previous step>", "RequestParameters": { "integration.request.header.ConnectionId": "context.connectionId", //passing context variable connectionId as ConnectionId header to backend "integration.request.header.any-header-key": "''static value'", //passing static value as querystring to backend "integration.request.querystring.any-querystring-key": "'static value'" } } ```
aws apigatewayv2 update-integration --cli-input-json file://integration.json