Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with multiValueQueryStringParameters and queryStringParameters when Array are indexed #1255

Open
throrin19 opened this issue Nov 4, 2024 · 1 comment
Labels

Comments

@throrin19
Copy link

Describe the bug
When we try to send Data to our API using query String with indexed array (default in axios), We don't have same thing than non indexed array :

Query parameters without indexed array :

http://localhost:8000?lite=true&measures[]=[%22TE%22,%22lavabo%22]&measures[]=[%22FL%22,%22lavabo%22]&measures[]=[%22VO%22,%22lavabo%22]&measures[]=[%22TE%22,%22lavab%22]
  • Result in Middy:
    • queryStringParameters :
      {"lite":"true", "measures[]":"[\"TE\",\"lavab\"]"}
      
    • multiValueQueryStringParameters :
      {"lite":["true"],"measures[]":["[\"TE\",\"lavabo\"]","[\"FL\",\"lavabo\"]","[\"VO\",\"lavabo\"]","[\"TE\",\"lavab\"]"]}
      

Query parameters with indexed array :

http://localhost:8000?lite=true&measures[0][0]=TE&measures[0][1]=lavab&measures[1][0]=VO&measures[1][1]=lavabo
  • Result in Middy:
    • queryStringParameters :
      {"lite":"true","measures[0][0]":"TE","measures[0][1]":"lavabo","measures[1][0]":"FL","measures[1][1]":"lavabo" }
      
    • multiValueQueryStringParameters :
      {"lite":["true"],"measures[0][0]":["TE"],"measures[0][1]":["lavabo"],"measures[1][0]":["FL"],"measures[1][1]":["lavabo"]}
      

To Reproduce
How to reproduce the behaviour:

  1. Launch a request with non indexed array
  2. Launch a request with indexed array

Expected behaviour
Same result between indexed and non indexed array : multiValueQueryStringParameters with correct values.

Environment (please complete the following information):

  • Node.js: 20.18.0
  • Middy: 5.5.1
  • AWS SDK: 3.682.0

Additional context
In local we launch it with serverless-offline

@throrin19 throrin19 added the bug label Nov 4, 2024
@willfarrell
Copy link
Member

Without middy, do you get the expected results from requests to lambda & serverless-offline? As far as I know, middy never modifies multiValueQueryStringParameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants