Hi All,
I encountered a weird issue: verification failed when the query has nested keys key_a[]=1&key_b[1]=2, key_a is an array, key_b is a hash.
Here is the output:
W, [2021-09-28T01:44:25.107664 #4532] WARN -- : Verifying - actual interactions do not match expected interactions.
Incorrect requests:
GET /api/products/my_endpoint?travel_date=2021-04-10&key_b[1]=2&key_a[]=1 (request query did not match)
Diff with interaction: "A get request to /api/products/my_endpoint" given "Resource 112 exists, and is available on 2021-05-21"
Diff
--------------------------------------
Key: - is expected
+ is actual
Matching keys and values are not shown
{
"query": {
- "key_a": [
+ "key_a[]": [
"1"
]
Description of differences
--------------------------------------
* Could not find key "key_a" (keys present are: key_b[1], key_a[]) at $.query
* Did not expect the key "key_a[]" to exist at $.query
I debug code and got some clues:
- When parsing the expected interaction, the query string:
key_a[]=1&key_b[1]=2 is covert to key_a=1&key_b[1]=2 because of the logic here.
- However when trying to match the candidate interactions with actual request, the square brackets in the actual query key
key_a[]=1 is not removed as in expected interaction key_a=1, which causes the inconsistency between expected interaction and actual interaction.
I'm wondering if it's a bug.
Hi All,
I encountered a weird issue: verification failed when the query has nested keys
key_a[]=1&key_b[1]=2, key_a is an array, key_b is a hash.Here is the output:
I debug code and got some clues:
key_a[]=1&key_b[1]=2is covert tokey_a=1&key_b[1]=2because of the logic here.key_a[]=1is not removed as in expected interactionkey_a=1, which causes the inconsistency between expected interaction and actual interaction.I'm wondering if it's a bug.