aws-api-gateway-cli-test icon indicating copy to clipboard operation
aws-api-gateway-cli-test copied to clipboard

How/where to insert multiValueQueryStringParameters?

Open gilneto8 opened this issue 5 years ago • 4 comments

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

gilneto8 avatar Feb 19 '20 17:02 gilneto8

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

jayair avatar Feb 23 '20 03:02 jayair

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.

gilneto8 avatar Feb 23 '20 12:02 gilneto8

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 avatar Mar 01 '20 22:03 jayair

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

jayair avatar Mar 01 '20 22:03 jayair