-
-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: IRequestBuilder.WithParam broken for key-only matching #159
Comments
This seems like a bug, I'll investigate. |
New code can be used like: server
.Given(Request
.Create()
.WithPath(new WildcardMatcher("/param2", true))
.WithParam("key", "test")
.UsingGet())
.RespondWith(Response.Create()
.WithHeader("Content-Type", "application/json")
.WithBodyAsJson(new { result = "param2" }));
server
.Given(Request
.Create()
.WithPath(new WildcardMatcher("/param3", true))
.WithParam("key", new WildcardMatcher("t*"))
.UsingGet())
.RespondWith(Response.Create()
.WithHeader("Content-Type", "application/json")
.WithBodyAsJson(new { result = "param3" })); See also linked code or branch : https://github.com/WireMock-Net/WireMock.Net/tree/Fix_IRequestBuilder.WithParam |
Cool, thanks. Looks like the original usage will work in the next release - is that correct? |
Correct the C# code will be backwards compatible. However the mapping JSON be changed and looks like: {
"Guid": "63f84226-8c13-483f-946c-9008cca9555e",
"Priority": 0,
"Request": {
"Path": {
"Matchers": [
{
"Name": "WildcardMatcher",
"Pattern": "/param3",
"IgnoreCase": true
}
]
},
"Methods": [
"get"
],
"Params": [
{
"Name": "key",
"Matchers": [
{
"Name": "WildcardMatcher",
"Pattern": "t*",
"IgnoreCase": false
}
]
}
]
} (You can use a WildcardMatcher, RegExMatcher, ExactMatcher or whatever.) |
Awesome - thanks for the advice and for the quick fix! |
NuGet is created |
I just upgraded our wiremock-net from
1.0.2.3
to1.0.4.2
and noticed that a few tests that were working have broken. This request matcher no longer works:The test issues an HTTP request like
GET /api/incidents/[email protected]
. In1.0.2.3
, this request was matched by the server, but not in1.0.4.2
. If I change the builder such that I call.WithParam("q", "[email protected]")
, it works.This seems like a regression, given that the API hasn't changed as far as I can tell.
The text was updated successfully, but these errors were encountered: