Closed basdijkstra closed 10 months ago
The easiest solution is to use WithParam
(I actually don't know if that path you use will work)
var server = WireMockServer.Start();
server.Given(
Request.Create()
.UsingGet()
.WithPath("/api/single-query-param-csv")
.WithParam("id", "1", "2", "3")
)
.RespondWith(
Response.Create().WithStatusCode(200)
);
That matches
id=1&id=2&id=3
not
id=1,2,3
I’m using that in a different test case here: https://github.com/basdijkstra/rest-assured-net/blob/a75c483c080c5bc352f5cb6ba2db0999a0a56964/RestAssured.Net.Tests/QueryParameterTests.cs#L230
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.
Ah, I didn't know it matched both. Updated my tests now and you're absolutely right:
https://github.com/basdijkstra/rest-assured-net/commit/16a2326de025b3ac3703ff6dd67098bd086f1a78
Thanks for the quick response! Closing this now as my question has been addressed.
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.