I have set up API Gateway v2 HTTP to SQS. It was fine. However, I would like to send optional headers from the HTTP request to SQS.
As far as I understand from the documentation, it is not possible to send the all headers to SQS, but only the ones that are defined explicitly. E.g. the following works fine:
{"UserAgent": {"DataType": "String", "StringValue": "${request.header.user-agent}"}, "anotherheader": {"DataType": "String", "StringValue": "${request.header.anotherheader}"}}
But it requires that both User-Agent
and AnotherHeader
headers are present in the HTTP request. What if AnotherHeader
header is optional. Is it possible to somehow define a default value? Because otherwise API Gateway returns Bad Request
.