I made a call to an API Gateway connected to a Lambda function. I was expecting to see multiValueQueryStringParameters as a key in the event input to my handler.
https://aws.amazon.com/blogs/compute/support-for-multi-value-parameters-in-amazon-api-gateway/
Instead, I was seeing a comma delimited list in queryStringParameters
So for example, this call:
https://12324234234234.execute-api.us-east-2.amazonaws.com/dois_to_pmids?a=1&a=2&a=3
generates the following event entry:
"queryStringParameters": {"a": "1,2,3"}
I tried making everything a proxy integration, first be doing:
GET /{proxy+}
and then by doing:
ANY /{proxy+}
with no luck.
https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-set-up-simple-proxy.html
https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html
What's going on?
So after a bit of digging I discovered an option when setting up the integration to select a payload version (either 1 or 2). You can currently read about the payload version formats (sort of, details are a bit light) here:
https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html
The main takeaway from that link is that version 2 doesn't have multiValueQueryStringParameters, instead repeated parameters are concatenated together in a comma separated list (as observed).
Haven't tested how this works with values that have commas :/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With