serverless-wsgi icon indicating copy to clipboard operation
serverless-wsgi copied to clipboard

Flask app list - gets always one element only

Open yairbr opened this issue 4 years ago • 2 comments

I have GET endpoint in Flask app that gets list of elements - but only one element is received. example - GET http://my-lambda.aws.com/my-endpoint?name=john&ids[]=8e7afb33&ids[]=6602f075

parsed request body -

{
      "name": "john",
      "ids": ["8e7afb33"]
}

when printing Flask request.query_string - name=john&ids[]=8e7afb33 is printed. I am using AWS Lambda behind an ALB with Flask (ALB logs indicates that request received as expected).

Thanks

yairbr avatar Dec 20 '20 10:12 yairbr

is there a workaround for this?

sbrady avatar Jul 21 '22 00:07 sbrady

I had a different issue, where I was getting the item as a string but comma separated something like this might help

def handler(event, context):
    event['queryStringParameters']['ids[]'] = event['queryStringParameters']['ids[]'].split(',')
    ....

sbrady avatar Jul 21 '22 01:07 sbrady

This should have been fixed by #87. Just tested and the example worked fine for both v1 and v2 APIGW requests. Please reopen if the problem persists.

logandk avatar Oct 06 '22 20:10 logandk