mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-08-20 10:24:13 +02:00
49 lines
1.4 KiB
C#
49 lines
1.4 KiB
C#
// Copyright © WireMock.Net
|
|
|
|
using Stef.Validation;
|
|
using WireMock.Matchers;
|
|
using WireMock.Matchers.Request;
|
|
|
|
namespace WireMock.RequestBuilders;
|
|
|
|
public partial class Request
|
|
{
|
|
/// <inheritdoc />
|
|
public IRequestBuilder WithClientIP(params IStringMatcher[] matchers)
|
|
{
|
|
return WithClientIP(MatchOperator.Or, matchers);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public IRequestBuilder WithClientIP(MatchOperator matchOperator, params IStringMatcher[] matchers)
|
|
{
|
|
Guard.NotNullOrEmpty(matchers);
|
|
|
|
_requestMatchers.Add(new RequestMessageClientIPMatcher(MatchBehaviour.AcceptOnMatch, matchOperator, matchers));
|
|
return this;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public IRequestBuilder WithClientIP(params string[] clientIPs)
|
|
{
|
|
return WithClientIP(MatchOperator.Or, clientIPs);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public IRequestBuilder WithClientIP(MatchOperator matchOperator, params string[] clientIPs)
|
|
{
|
|
Guard.NotNullOrEmpty(clientIPs);
|
|
|
|
_requestMatchers.Add(new RequestMessageClientIPMatcher(MatchBehaviour.AcceptOnMatch, matchOperator, clientIPs));
|
|
return this;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public IRequestBuilder WithClientIP(params Func<string, bool>[] funcs)
|
|
{
|
|
Guard.NotNullOrEmpty(funcs);
|
|
|
|
_requestMatchers.Add(new RequestMessageClientIPMatcher(funcs));
|
|
return this;
|
|
}
|
|
} |