swift-server / swift-aws-lambda-runtime

Swift implementation of AWS Lambda Runtime
Apache License 2.0
1.13k stars 102 forks source link

Fixing the queryStringParameters variable for ALB #182

Closed proggeramlug closed 3 years ago

proggeramlug commented 3 years ago

Adjusted the queryStringParameters to be actually working with ALB.

Motivation:

I want my Vapor apps to work through Lambda. However, this structure does not properly represent what AWS ALB is sending to the handler. There might be use-cases in which the original implementation is working but it looks fairly untested to me and I could not find the structure, as it is now, in any examples provided by AWS.

Modifications:

Change queryStringParameters from [String:[String]] to [String:String].

Result:

It works with the actual ALB (live example can be provided if desired) and I did not come across any need for the original implementation.

swift-server-bot commented 3 years ago

Can one of the admins verify this patch?

swift-server-bot commented 3 years ago

Can one of the admins verify this patch?

swift-server-bot commented 3 years ago

Can one of the admins verify this patch?

swift-server-bot commented 3 years ago

Can one of the admins verify this patch?

fabianfett commented 3 years ago

@swift-server-bot test this please

proggeramlug commented 3 years ago

@fabianfett Do you have a specific use case for multiValueQueryStringParameters? I did not dig any deeper than my use-case required but I did not come across that specific parameter being passed.

fabianfett commented 3 years ago

You can enable multiValueHeaders as documented by AWS. AFAIK if you enable multiValueHeaders the property be multiValueQueryStringParameters will be used instead of queryStringParameters. There is more documentation around multiValueHeaders.

Of course the current implementation doesn't work with either of those. So it's definitely a fix that should go in!