mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-02-25 18:25:10 +01:00
* 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>
50 lines
2.3 KiB
C#
50 lines
2.3 KiB
C#
// Copyright © WireMock.Net
|
|
|
|
using System;
|
|
using Stef.Validation;
|
|
using WireMock.Settings;
|
|
|
|
namespace WireMock.Owin;
|
|
|
|
internal static class WireMockMiddlewareOptionsHelper
|
|
{
|
|
public static IWireMockMiddlewareOptions InitFromSettings(
|
|
WireMockServerSettings settings,
|
|
IWireMockMiddlewareOptions? options = null,
|
|
Action<IWireMockMiddlewareOptions>? postConfigure = null
|
|
)
|
|
{
|
|
Guard.NotNull(settings);
|
|
|
|
options ??= new WireMockMiddlewareOptions();
|
|
|
|
options.AllowBodyForAllHttpMethods = settings.AllowBodyForAllHttpMethods;
|
|
options.AllowOnlyDefinedHttpStatusCodeInResponse = settings.AllowOnlyDefinedHttpStatusCodeInResponse;
|
|
options.AllowPartialMapping = settings.AllowPartialMapping;
|
|
options.DisableJsonBodyParsing = settings.DisableJsonBodyParsing;
|
|
options.DisableRequestBodyDecompressing = settings.DisableRequestBodyDecompressing;
|
|
options.DoNotSaveDynamicResponseInLogEntry = settings.DoNotSaveDynamicResponseInLogEntry;
|
|
options.FileSystemHandler = settings.FileSystemHandler;
|
|
options.HandleRequestsSynchronously = settings.HandleRequestsSynchronously;
|
|
options.Logger = settings.Logger;
|
|
options.MaxRequestLogCount = settings.MaxRequestLogCount;
|
|
options.PostWireMockMiddlewareInit = settings.PostWireMockMiddlewareInit;
|
|
options.PreWireMockMiddlewareInit = settings.PreWireMockMiddlewareInit;
|
|
options.QueryParameterMultipleValueSupport = settings.QueryParameterMultipleValueSupport;
|
|
options.RequestLogExpirationDuration = settings.RequestLogExpirationDuration;
|
|
options.SaveUnmatchedRequests = settings.SaveUnmatchedRequests;
|
|
|
|
if (settings.CustomCertificateDefined)
|
|
{
|
|
options.X509StoreName = settings.CertificateSettings!.X509StoreName;
|
|
options.X509StoreLocation = settings.CertificateSettings.X509StoreLocation;
|
|
options.X509ThumbprintOrSubjectName = settings.CertificateSettings.X509StoreThumbprintOrSubjectName;
|
|
options.X509CertificateFilePath = settings.CertificateSettings.X509CertificateFilePath;
|
|
options.X509CertificatePassword = settings.CertificateSettings.X509CertificatePassword;
|
|
}
|
|
|
|
postConfigure?.Invoke(options);
|
|
|
|
return options;
|
|
}
|
|
} |