Files
WireMock.Net-wiremock/src/WireMock.Net.Minimal/ResponseBuilders/Response.WithProxy.cs
T
Stef Heyenrath 96eca4262a Create WireMock.Net.MimePart project (#1300)
* 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>
2025-05-24 12:17:42 +02:00

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);
}
}