Skip to content

Conversation

mrautio
Copy link
Contributor

@mrautio mrautio commented Jul 14, 2023

This has a dependency on a PR of query-map-rs: calavera/query-map-rs#11

API Gateway Lambda proxy payload's queryStringParameters is serialized incorrectly to format like "queryStringParameters":{"key":["value"]} when it should be like "queryStringParameters":{"key":"value"}
Reference: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html

Description of changes:

  • Corrected serialization of queryStringParameters for API Gateway Lambda proxy payload format version 1.0 and 2.0

By submitting this pull request

  • I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • I confirm that I've made a best effort attempt to update all relevant documentation.

@calavera
Copy link
Contributor

What's the V1 format when there are multiple parameters with the same name?

@mrautio
Copy link
Contributor Author

mrautio commented Jul 14, 2023

What's the V1 format when there are multiple parameters with the same name?

Whoops, I misread the AWS doc. Now V1 value is correct. In V1 first value will be used if there are multiple values.

Example:
Source data: "key": ["value1", "value2"]
V1: "key": "value1"
V2: "key": "value1,value2"

@calavera
Copy link
Contributor

This might be better directly in the QueryMap library, so it's transparent here: https://github.com/calavera/query-map-rs/tree/main/src/serde

@mrautio mrautio marked this pull request as draft July 14, 2023 17:06
@mrautio mrautio marked this pull request as ready for review July 15, 2023 07:35
@mrautio
Copy link
Contributor Author

mrautio commented Jul 15, 2023

@calavera I've split the change to two PRs, query-map-rs PR here: calavera/query-map-rs#11

@calavera
Copy link
Contributor

calavera commented Jul 15, 2023

Thanks! I've just published the version 0.7.0 of query map. Feel free to update this PR with the changes to use that. I think you only need to bump the version in the Cargo.toml file, and everything should work.

Reference: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html
'queryStringParameters' were serialized incorrectly to format like queryStringParameters:{"key":["value"]} when it should be like queryStringParameters:{"key":"value"}
@mrautio
Copy link
Contributor Author

mrautio commented Jul 16, 2023

thank you for the quick release! I've now bumped the query_map version to 0.7 in this PR

Copy link
Contributor

@calavera calavera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome, thanks!

@calavera calavera merged commit 6c3272f into awslabs:main Jul 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants