mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-06-14 17:44:31 +02:00
96eca4262a
* Create WireMock.Net.MimePart project * . * REFACTOR * ILRepack * -- * ... * x * x * . * fix * public class MimePartMatcher * shared * min * . * <!--<DelaySign>true</DelaySign>--> * Update README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
59 lines
1.5 KiB
C#
59 lines
1.5 KiB
C#
// Copyright © WireMock.Net
|
|
|
|
using System.Net.Http;
|
|
using WireMock.Http;
|
|
using WireMock.Settings;
|
|
using Stef.Validation;
|
|
using System.Security.Cryptography.X509Certificates;
|
|
|
|
namespace WireMock.ResponseBuilders;
|
|
|
|
public partial class Response
|
|
{
|
|
private HttpClient? _httpClientForProxy;
|
|
|
|
/// <summary>
|
|
/// The WebProxy settings.
|
|
/// </summary>
|
|
public ProxyAndRecordSettings? ProxyAndRecordSettings { get; private set; }
|
|
|
|
/// <inheritdoc />
|
|
public IResponseBuilder WithProxy(string proxyUrl, string? clientX509Certificate2ThumbprintOrSubjectName = null)
|
|
{
|
|
Guard.NotNullOrEmpty(proxyUrl);
|
|
|
|
var settings = new ProxyAndRecordSettings
|
|
{
|
|
Url = proxyUrl,
|
|
ClientX509Certificate2ThumbprintOrSubjectName = clientX509Certificate2ThumbprintOrSubjectName
|
|
};
|
|
|
|
return WithProxy(settings);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public IResponseBuilder WithProxy(ProxyAndRecordSettings settings)
|
|
{
|
|
Guard.NotNull(settings);
|
|
|
|
ProxyAndRecordSettings = settings;
|
|
|
|
_httpClientForProxy = HttpClientBuilder.Build(settings);
|
|
return this;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public IResponseBuilder WithProxy(string proxyUrl, X509Certificate2 certificate)
|
|
{
|
|
Guard.NotNullOrEmpty(proxyUrl);
|
|
Guard.NotNull(certificate);
|
|
|
|
var settings = new ProxyAndRecordSettings
|
|
{
|
|
Url = proxyUrl,
|
|
Certificate = certificate
|
|
};
|
|
|
|
return WithProxy(settings);
|
|
}
|
|
} |