mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-21 16:48:59 +01:00
RejectOnMatch (wip)
This commit is contained in:
@@ -32,17 +32,17 @@ namespace WireMock.Matchers.Request
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RequestMessageBodyMatcher"/> class.
|
||||
/// </summary>
|
||||
/// <param name="body">The body.</param>
|
||||
/// <param name="matchBehaviour">The match behaviour.</param>
|
||||
public RequestMessageBodyMatcher(MatchBehaviour matchBehaviour, [NotNull] string body) : this(new SimMetricsMatcher(matchBehaviour, body))
|
||||
/// <param name="body">The body.</param>
|
||||
public RequestMessageBodyMatcher(MatchBehaviour matchBehaviour, [NotNull] string body) : this(new WildcardMatcher(matchBehaviour, body))
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RequestMessageBodyMatcher"/> class.
|
||||
/// </summary>
|
||||
/// <param name="body">The body.</param>
|
||||
/// <param name="matchBehaviour">The match behaviour.</param>
|
||||
/// <param name="body">The body.</param>
|
||||
public RequestMessageBodyMatcher(MatchBehaviour matchBehaviour, [NotNull] byte[] body) : this(new ExactObjectMatcher(matchBehaviour, body))
|
||||
{
|
||||
}
|
||||
@@ -50,8 +50,8 @@ namespace WireMock.Matchers.Request
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RequestMessageBodyMatcher"/> class.
|
||||
/// </summary>
|
||||
/// <param name="body">The body.</param>
|
||||
/// <param name="matchBehaviour">The match behaviour.</param>
|
||||
/// <param name="body">The body.</param>
|
||||
public RequestMessageBodyMatcher(MatchBehaviour matchBehaviour, [NotNull] object body) : this(new ExactObjectMatcher(matchBehaviour, body))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ namespace WireMock.Matchers.Request
|
||||
/// </summary>
|
||||
public class RequestMessageCookieMatcher : IRequestMatcher
|
||||
{
|
||||
private readonly MatchBehaviour _matchBehaviour;
|
||||
|
||||
/// <value>
|
||||
/// The funcs.
|
||||
/// </value>
|
||||
@@ -38,6 +40,7 @@ namespace WireMock.Matchers.Request
|
||||
Check.NotNull(name, nameof(name));
|
||||
Check.NotNull(pattern, nameof(pattern));
|
||||
|
||||
_matchBehaviour = matchBehaviour;
|
||||
Name = name;
|
||||
Matchers = new IStringMatcher[] { new WildcardMatcher(matchBehaviour, pattern, ignoreCase) };
|
||||
}
|
||||
@@ -78,7 +81,7 @@ namespace WireMock.Matchers.Request
|
||||
{
|
||||
if (requestMessage.Cookies == null)
|
||||
{
|
||||
return MatchScores.Mismatch;
|
||||
return MatchBehaviourHelper.Convert(_matchBehaviour, MatchScores.Mismatch);
|
||||
}
|
||||
|
||||
if (Funcs != null)
|
||||
@@ -93,7 +96,7 @@ namespace WireMock.Matchers.Request
|
||||
|
||||
if (!requestMessage.Cookies.ContainsKey(Name))
|
||||
{
|
||||
return MatchScores.Mismatch;
|
||||
return MatchBehaviourHelper.Convert(_matchBehaviour, MatchScores.Mismatch);
|
||||
}
|
||||
|
||||
string value = requestMessage.Cookies[Name];
|
||||
|
||||
@@ -13,6 +13,8 @@ namespace WireMock.Matchers.Request
|
||||
/// <inheritdoc cref="IRequestMatcher"/>
|
||||
public class RequestMessageHeaderMatcher : IRequestMatcher
|
||||
{
|
||||
private readonly MatchBehaviour _matchBehaviour;
|
||||
|
||||
/// <summary>
|
||||
/// The functions
|
||||
/// </summary>
|
||||
@@ -37,10 +39,10 @@ namespace WireMock.Matchers.Request
|
||||
/// <param name="matchBehaviour">The match behaviour.</param>
|
||||
public RequestMessageHeaderMatcher(MatchBehaviour matchBehaviour, [NotNull] string name, [NotNull] string pattern, bool ignoreCase)
|
||||
{
|
||||
|
||||
Check.NotNull(name, nameof(name));
|
||||
Check.NotNull(pattern, nameof(pattern));
|
||||
|
||||
_matchBehaviour = matchBehaviour;
|
||||
Name = name;
|
||||
Matchers = new IStringMatcher[] { new WildcardMatcher(matchBehaviour, pattern, ignoreCase) };
|
||||
}
|
||||
@@ -97,7 +99,7 @@ namespace WireMock.Matchers.Request
|
||||
{
|
||||
if (requestMessage.Headers == null)
|
||||
{
|
||||
return MatchScores.Mismatch;
|
||||
return MatchBehaviourHelper.Convert(_matchBehaviour, MatchScores.Mismatch);
|
||||
}
|
||||
|
||||
if (Funcs != null)
|
||||
@@ -112,7 +114,7 @@ namespace WireMock.Matchers.Request
|
||||
|
||||
if (!requestMessage.Headers.ContainsKey(Name))
|
||||
{
|
||||
return MatchScores.Mismatch;
|
||||
return MatchBehaviourHelper.Convert(_matchBehaviour, MatchScores.Mismatch);
|
||||
}
|
||||
|
||||
WireMockList<string> list = requestMessage.Headers[Name];
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace WireMock.Matchers.Request
|
||||
public class RequestMessagePathMatcher : IRequestMatcher
|
||||
{
|
||||
/// <summary>
|
||||
/// The matcher.
|
||||
/// The matchers
|
||||
/// </summary>
|
||||
public IReadOnlyList<IStringMatcher> Matchers { get; }
|
||||
|
||||
@@ -37,6 +37,7 @@ namespace WireMock.Matchers.Request
|
||||
public RequestMessagePathMatcher([NotNull] params IStringMatcher[] matchers)
|
||||
{
|
||||
Check.NotNull(matchers, nameof(matchers));
|
||||
|
||||
Matchers = matchers;
|
||||
}
|
||||
|
||||
@@ -47,6 +48,7 @@ namespace WireMock.Matchers.Request
|
||||
public RequestMessagePathMatcher([NotNull] params Func<string, bool>[] funcs)
|
||||
{
|
||||
Check.NotNull(funcs, nameof(funcs));
|
||||
|
||||
Funcs = funcs;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user