WireMock.Net is a flexible product for stubbing and mocking web HTTP responses using advanced request matching and response templating. Based on the functionality from http://WireMock.org, but extended with more functionality.
Apache License 2.0
1.41k
stars
209
forks
source link
AbstractJsonPartialMatcher: Regex Value is Uppercased when IgnoreCase is set to true #1117
AbstractJsonPartialMatcher
When IgnoreCase is true, and Regex is true, the value used as a regex is upper-cased.
This changes a given regex and causes a non-match. Example:
"^\d+$" is changed to "^\D+$"
Expected behavior:
Expect the given regex to be used.
Test to reproduce
Create a request mapping, with Regex = true and IgnoreCase = true
Define json object with regex: { "x" : "^\d+$" }
Other related info
Test to Demonstrate:
[Fact]
public void JsonPartialWildcardMatcher_IsMatch_WithIgnoreCaseTrueAndRegexTrue_JObject()
{
// Assign
var matcher = new JsonPartialWildcardMatcher(new { id = 1, Number = "^\\d+$" }, true, true);
// Act
var jObject = new JObject
{
{ "Id", new JValue(1) },
{ "Number", new JValue(1) }
};
double match = matcher.IsMatch(jObject).Score;
// Assert
Assert.Equal(1.0, match);
}
Describe the bug
AbstractJsonPartialMatcher When IgnoreCase is true, and Regex is true, the value used as a regex is upper-cased. This changes a given regex and causes a non-match. Example: "^\d+$" is changed to "^\D+$"
Expected behavior:
Expect the given regex to be used.
Test to reproduce
Other related info
Test to Demonstrate: