mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-26 19:11:04 +01:00
Partial matching
This commit is contained in:
@@ -53,16 +53,28 @@ namespace WireMock.Matchers.Request
|
||||
/// Determines whether the specified RequestMessage is match.
|
||||
/// </summary>
|
||||
/// <param name="requestMessage">The RequestMessage.</param>
|
||||
/// <param name="requestMatchResult">The RequestMatchResult.</param>
|
||||
/// <returns>
|
||||
/// <c>true</c> if the specified RequestMessage is match; otherwise, <c>false</c>.
|
||||
/// </returns>
|
||||
public bool IsMatch(RequestMessage requestMessage)
|
||||
public bool IsMatch(RequestMessage requestMessage, RequestMatchResult requestMatchResult)
|
||||
{
|
||||
bool isMatch = IsMatch(requestMessage);
|
||||
if (isMatch)
|
||||
requestMatchResult.Matched++;
|
||||
|
||||
requestMatchResult.Total++;
|
||||
|
||||
return isMatch;
|
||||
}
|
||||
|
||||
private bool IsMatch(RequestMessage requestMessage)
|
||||
{
|
||||
if (Matchers != null)
|
||||
return Matchers.Any(matcher => matcher.IsMatch(requestMessage.Path));
|
||||
|
||||
if (Funcs != null)
|
||||
return Funcs.Any(func => func(requestMessage.Path));
|
||||
return requestMessage.Path != null && Funcs.Any(func => func(requestMessage.Path));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user