mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-06-26 07:16:26 +02:00
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>
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user