AnomalyInnovations / aws-api-gateway-cli-test

A simple CLI to test API Gateway endpoints with IAM authorization
MIT License
120 stars 29 forks source link

How/where to insert multiValueQueryStringParameters? #19

Open gilneto8 opened 4 years ago

gilneto8 commented 4 years ago

Hi,

Right now I'm trying to test a deployment I made where I'm checking if one or more values are present on a specific field in any item. As such, this is what I'm sending:

--additional-params {\"queryParams\":{\"tag\":\"Rust\",\"tag\":\"nodejs\",\"op\":\"or\"}}

I can use the tag parameter on the multiValueQueryStringParameters object, as such:

{
  "queryStringParameters": {
    "op": "or"
  },
  "multiValueQueryStringParameters": {
    "tag": ["Rust","nodejs"]
  },
  "requestContext": {
    "identity": {
      "cognitoIdentityId": "admin123"
    }
  }
}

this logic is ok when I'm testing locally, but isn't working against dynamodb using the aws-api-gateway-cli-test, while there are values to be returned for such a query. What am I missing?

Gil

jayair commented 4 years ago

I'm not sure I completely follow. Are you passing the multiValueQueryStringParameters as a CLI option?

gilneto8 commented 4 years ago

Let me try to be clearer, then.

On the AWS documentation, it states that when you pass repeated query string values, the object sent to Dynamo gets a specific field with all the possible values for any field. In this case, I want to use an URL that has the following structure:

.../notes?tag=Rust&tag=nodejs

and the object created by the API Gateway contains this part:

queryStringParameters: { tag: 'nodejs' },
multiValueQueryStringParameters: { tag: [ 'Rust', 'nodejs' ] },

As I'm interested in all the values for the query field, I have to access the multiValueQueryStringParameters. This works locally when I try to mock the service with a hardcoded request with this parameter, like in the code snippet I sent originally.

However, when I try to use the CLI, I don't know how to pass these multi-valued parameters. That's my question here: how do I do this?

Cheers.

jayair commented 4 years ago

I see. We internally use aws-api-gateway-client and I don't think they support that. So I'm not entirely sure how to do this.

jayair commented 4 years ago

I should add, if anybody wants to investigate, this is something we should add support for.