mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 21:10:32 +01:00
How can I match on query parameters with comma-separated values? #541
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @basdijkstra on GitHub (Aug 12, 2023).
So, I'm running this test using RestAssured.Net:
This is the HTTP call that is being made:
And here's the WireMock.Net stub definition I expect to match this request:
However, when I run the test, WireMock.Net returns a 404, not a 200, so for some reason my request isn't properly matched. Any ideas?
This doesn't work either:
I'm using version 1.5.34, i.e., the latest stable at the time of posting this question.
@StefH commented on GitHub (Aug 12, 2023):
The easiest solution is to use
WithParam(I actually don't know if that path you use will work)
@basdijkstra commented on GitHub (Aug 12, 2023):
That matches
id=1&id=2&id=3
not
id=1,2,3
I’m using that in a different test case here:
a75c483c08/RestAssured.Net.Tests/QueryParameterTests.cs (L230)@StefH commented on GitHub (Aug 12, 2023):
It actually matches both.
See https://github.com/WireMock-Net/WireMock.Net/pull/992
If you only want exactly match on the the string "1,2,3" you need to take a look in that other unit test in the same file which I changed in that PR.
@basdijkstra commented on GitHub (Aug 12, 2023):
Ah, I didn't know it matched both. Updated my tests now and you're absolutely right:
16a2326de0Thanks for the quick response! Closing this now as my question has been addressed.