diff --git a/Directory.Build.props b/Directory.Build.props
index 470fe55b..67c02e00 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -4,7 +4,7 @@
- 1.11.2
+ 2.0.0-preview-01
WireMock.Net-Logo.png
https://github.com/wiremock/WireMock.Net
Apache-2.0
@@ -13,7 +13,7 @@
https://github.com/wiremock/WireMock.Net
../../resources/WireMock.Net-Logo.ico
PackageReadme.md
- 12.0
+ 13
enable
@@ -51,17 +51,17 @@
-
+
-
+
+ net48;net8.0
true
$(NoWarn);1591;8603
WireMock.Net.Abstractions
@@ -33,32 +34,36 @@
true
-
+
-
+
-
-
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
\ No newline at end of file
diff --git a/src/WireMock.Net.AspNetCore.Middleware/WireMock.Net.AspNetCore.Middleware.csproj b/src/WireMock.Net.AspNetCore.Middleware/WireMock.Net.AspNetCore.Middleware.csproj
index c594bfc3..4b62f48a 100644
--- a/src/WireMock.Net.AspNetCore.Middleware/WireMock.Net.AspNetCore.Middleware.csproj
+++ b/src/WireMock.Net.AspNetCore.Middleware/WireMock.Net.AspNetCore.Middleware.csproj
@@ -38,7 +38,7 @@
-
+
diff --git a/src/WireMock.Net.AwesomeAssertions/WireMock.Net.AwesomeAssertions.csproj b/src/WireMock.Net.AwesomeAssertions/WireMock.Net.AwesomeAssertions.csproj
index e07493d9..af89aadc 100644
--- a/src/WireMock.Net.AwesomeAssertions/WireMock.Net.AwesomeAssertions.csproj
+++ b/src/WireMock.Net.AwesomeAssertions/WireMock.Net.AwesomeAssertions.csproj
@@ -1,10 +1,11 @@
-
+
AwesomeAssertions extensions for WireMock.Net
WireMock.Net.AwesomeAssertions
Francesco Venturoli;Mahmoud Ali;Stef Heyenrath
- net47;netstandard2.0;netstandard2.1
+
+ net48;net8.0
true
WireMock.Net.AwesomeAssertions
WireMock.Net.AwesomeAssertions
diff --git a/src/WireMock.Net.Extensions.Routing/Models/WireMockRequestInfo{TBody}.cs b/src/WireMock.Net.Extensions.Routing/Models/WireMockRequestInfo{TBody}.cs
index e803a3cb..51879a8e 100644
--- a/src/WireMock.Net.Extensions.Routing/Models/WireMockRequestInfo{TBody}.cs
+++ b/src/WireMock.Net.Extensions.Routing/Models/WireMockRequestInfo{TBody}.cs
@@ -21,4 +21,4 @@ public sealed class WireMockRequestInfo : WireMockRequestInfo
/// Gets or initializes the deserialized request body.
///
public TBody? Body { get; init; }
-}
+}
\ No newline at end of file
diff --git a/src/WireMock.Net.Extensions.Routing/WireMock.Net.Extensions.Routing.csproj b/src/WireMock.Net.Extensions.Routing/WireMock.Net.Extensions.Routing.csproj
index 70791227..f562ec64 100644
--- a/src/WireMock.Net.Extensions.Routing/WireMock.Net.Extensions.Routing.csproj
+++ b/src/WireMock.Net.Extensions.Routing/WireMock.Net.Extensions.Routing.csproj
@@ -25,10 +25,10 @@
-
+
-
+
\ No newline at end of file
diff --git a/src/WireMock.Net.FluentAssertions/WireMock.Net.FluentAssertions.csproj b/src/WireMock.Net.FluentAssertions/WireMock.Net.FluentAssertions.csproj
index 2c01e288..c0b204bf 100644
--- a/src/WireMock.Net.FluentAssertions/WireMock.Net.FluentAssertions.csproj
+++ b/src/WireMock.Net.FluentAssertions/WireMock.Net.FluentAssertions.csproj
@@ -1,10 +1,11 @@
-
+
FluentAssertions extensions for WireMock.Net
WireMock.Net.FluentAssertions
Mahmoud Ali;Stef Heyenrath
- net451;net47;netstandard1.3;netstandard2.0;netstandard2.1
+
+ net48;net8.0
true
WireMock.Net.FluentAssertions
WireMock.Net.FluentAssertions
@@ -31,12 +32,12 @@
true
-
+
-
-
+
+
diff --git a/src/WireMock.Net.GraphQL/WireMock.Net.GraphQL.csproj b/src/WireMock.Net.GraphQL/WireMock.Net.GraphQL.csproj
index 51235cff..68d9dc05 100644
--- a/src/WireMock.Net.GraphQL/WireMock.Net.GraphQL.csproj
+++ b/src/WireMock.Net.GraphQL/WireMock.Net.GraphQL.csproj
@@ -4,7 +4,8 @@
GraphQL support for WireMock.Net
WireMock.Net.Matchers.GraphQL
Stef Heyenrath
- netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0;net8.0
+
+ net48;net8.0
true
wiremock;matchers;matcher;graphql
WireMock
@@ -26,22 +27,22 @@
-
+
-
+
-
+
\ No newline at end of file
diff --git a/src/WireMock.Net.Matchers.CSharpCode/Matchers/CSharpCodeMatcher.cs b/src/WireMock.Net.Matchers.CSharpCode/Matchers/CSharpCodeMatcher.cs
index 7e557b24..fe65e1da 100644
--- a/src/WireMock.Net.Matchers.CSharpCode/Matchers/CSharpCodeMatcher.cs
+++ b/src/WireMock.Net.Matchers.CSharpCode/Matchers/CSharpCodeMatcher.cs
@@ -108,72 +108,72 @@ public class CSharpCodeMatcher : ICSharpCodeMatcher
object? result;
-#if (NET451 || NET452)
- var compilerParams = new System.CodeDom.Compiler.CompilerParameters
- {
- GenerateInMemory = true,
- GenerateExecutable = false,
- ReferencedAssemblies =
- {
- "System.dll",
- "System.Core.dll",
- "Microsoft.CSharp.dll",
- "Newtonsoft.Json.dll"
- }
- };
+ //#if (NET451 || NET452)
+ // var compilerParams = new System.CodeDom.Compiler.CompilerParameters
+ // {
+ // GenerateInMemory = true,
+ // GenerateExecutable = false,
+ // ReferencedAssemblies =
+ // {
+ // "System.dll",
+ // "System.Core.dll",
+ // "Microsoft.CSharp.dll",
+ // "Newtonsoft.Json.dll"
+ // }
+ // };
- using (var codeProvider = new Microsoft.CSharp.CSharpCodeProvider())
- {
- var compilerResults = codeProvider.CompileAssemblyFromSource(compilerParams, source);
+ // using (var codeProvider = new Microsoft.CSharp.CSharpCodeProvider())
+ // {
+ // var compilerResults = codeProvider.CompileAssemblyFromSource(compilerParams, source);
- if (compilerResults.Errors.Count != 0)
- {
- var errors = from System.CodeDom.Compiler.CompilerError er in compilerResults.Errors select er.ToString();
- throw new WireMockException(string.Join(", ", errors));
- }
+ // if (compilerResults.Errors.Count != 0)
+ // {
+ // var errors = from System.CodeDom.Compiler.CompilerError er in compilerResults.Errors select er.ToString();
+ // throw new WireMockException(string.Join(", ", errors));
+ // }
- var helper = compilerResults.CompiledAssembly?.CreateInstance("CodeHelper");
- if (helper == null)
- {
- throw new WireMockException("CSharpCodeMatcher: Unable to create instance from WireMock.CodeHelper");
- }
+ // var helper = compilerResults.CompiledAssembly?.CreateInstance("CodeHelper");
+ // if (helper == null)
+ // {
+ // throw new WireMockException("CSharpCodeMatcher: Unable to create instance from WireMock.CodeHelper");
+ // }
- var methodInfo = helper.GetType().GetMethod("IsMatch");
- if (methodInfo == null)
- {
- throw new WireMockException("CSharpCodeMatcher: Unable to find method 'IsMatch' in WireMock.CodeHelper");
- }
+ // var methodInfo = helper.GetType().GetMethod("IsMatch");
+ // if (methodInfo == null)
+ // {
+ // throw new WireMockException("CSharpCodeMatcher: Unable to find method 'IsMatch' in WireMock.CodeHelper");
+ // }
- try
- {
- result = methodInfo.Invoke(helper, new[] { inputValue });
- }
- catch (Exception ex)
- {
- throw new WireMockException("CSharpCodeMatcher: Unable to call method 'IsMatch' in WireMock.CodeHelper", ex);
- }
- }
-#elif (NET46 || NET461)
- dynamic script;
- try
- {
- script = CSScriptLibrary.CSScript.Evaluator.CompileCode(source).CreateObject("*");
- }
- catch (Exception ex)
- {
- throw new WireMockException("CSharpCodeMatcher: Unable to create compiler for WireMock.CodeHelper", ex);
- }
-
- try
- {
- result = script.IsMatch(inputValue);
- }
- catch (Exception ex)
- {
- throw new WireMockException("CSharpCodeMatcher: Problem calling method 'IsMatch' in WireMock.CodeHelper", ex);
- }
+ // try
+ // {
+ // result = methodInfo.Invoke(helper, new[] { inputValue });
+ // }
+ // catch (Exception ex)
+ // {
+ // throw new WireMockException("CSharpCodeMatcher: Unable to call method 'IsMatch' in WireMock.CodeHelper", ex);
+ // }
+ // }
+ //#elif (NET46 || NET461)
+ // dynamic script;
+ // try
+ // {
+ // script = CSScriptLibrary.CSScript.Evaluator.CompileCode(source).CreateObject("*");
+ // }
+ // catch (Exception ex)
+ // {
+ // throw new WireMockException("CSharpCodeMatcher: Unable to create compiler for WireMock.CodeHelper", ex);
+ // }
-#elif (NETSTANDARD2_0 || NETSTANDARD2_1 || NETCOREAPP3_1 || NET5_0_OR_GREATER)
+ // try
+ // {
+ // result = script.IsMatch(inputValue);
+ // }
+ // catch (Exception ex)
+ // {
+ // throw new WireMockException("CSharpCodeMatcher: Problem calling method 'IsMatch' in WireMock.CodeHelper", ex);
+ // }
+
+ //#elif (NETSTANDARD2_0 || NETSTANDARD2_1 || NETCOREAPP3_1 || NET5_0_OR_GREATER || NET48)
Assembly assembly;
try
{
@@ -202,9 +202,9 @@ public class CSharpCodeMatcher : ICSharpCodeMatcher
{
throw new WireMockException("CSharpCodeMatcher: Problem calling method 'IsMatch' in WireMock.CodeHelper", ex);
}
-#else
- throw new NotSupportedException("The 'CSharpCodeMatcher' cannot be used in netstandard 1.3");
-#endif
+ //#else
+ // throw new NotSupportedException("The 'CSharpCodeMatcher' cannot be used in netstandard 1.3");
+ //#endif
try
{
return (bool)result;
diff --git a/src/WireMock.Net.Matchers.CSharpCode/WireMock.Net.Matchers.CSharpCode.csproj b/src/WireMock.Net.Matchers.CSharpCode/WireMock.Net.Matchers.CSharpCode.csproj
index ec560aae..687e05c3 100644
--- a/src/WireMock.Net.Matchers.CSharpCode/WireMock.Net.Matchers.CSharpCode.csproj
+++ b/src/WireMock.Net.Matchers.CSharpCode/WireMock.Net.Matchers.CSharpCode.csproj
@@ -4,7 +4,8 @@
A CSharpCodeMatcher which can be used to match WireMock.Net Requests using C# code.
WireMock.Net.Matchers.CSharpCode
Stef Heyenrath
- net451;net452;net46;net461;netstandard1.3;netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0
+
+ net48;net8.0
true
wiremock;matchers;matcher;csharp;csharpcode
WireMock
@@ -37,7 +38,7 @@
-
+
+
+
+
\ No newline at end of file
diff --git a/src/WireMock.Net.MimePart/Models/MimeMessageDataWrapper.cs b/src/WireMock.Net.MimePart/Models/MimeMessageDataWrapper.cs
index a4463f20..52a5e639 100644
--- a/src/WireMock.Net.MimePart/Models/MimeMessageDataWrapper.cs
+++ b/src/WireMock.Net.MimePart/Models/MimeMessageDataWrapper.cs
@@ -135,6 +135,6 @@ internal class MimeMessageDataWrapper : IMimeMessageData
///
public override string ToString()
{
- return _message.ToString();
+ return _message.ToString() ?? string.Empty;
}
}
\ No newline at end of file
diff --git a/src/WireMock.Net.MimePart/WireMock.Net.MimePart.csproj b/src/WireMock.Net.MimePart/WireMock.Net.MimePart.csproj
index 26251d62..979b8844 100644
--- a/src/WireMock.Net.MimePart/WireMock.Net.MimePart.csproj
+++ b/src/WireMock.Net.MimePart/WireMock.Net.MimePart.csproj
@@ -4,7 +4,8 @@
MultiPart Mime support for WireMock.Net using MimeKitLite
WireMock.Net.MimePart
Stef Heyenrath
- netstandard2.0;netstandard2.1;net462;net47;net48;net6.0;net8.0
+
+ net48;net8.0
true
wiremock;matchers;matcher;mime;multipart;mimekit
WireMock
@@ -36,11 +37,11 @@
-
+
+
-
+
-
+
diff --git a/src/WireMock.Net.Minimal/Compatibility/StringExtensions.cs b/src/WireMock.Net.Minimal/Compatibility/StringExtensions.cs
index a4eb0e92..f3cdea60 100644
--- a/src/WireMock.Net.Minimal/Compatibility/StringExtensions.cs
+++ b/src/WireMock.Net.Minimal/Compatibility/StringExtensions.cs
@@ -1,6 +1,6 @@
// Copyright © WireMock.Net
-#if NET451 || NET452 || NET46 || NET451 || NET461 || NETSTANDARD1_3 || NETSTANDARD2_0
+#if NET451 || NET452 || NET46 || NET461 || NET48 || NETSTANDARD1_3 || NETSTANDARD2_0
using System.Text.RegularExpressions;
using WireMock.Constants;
diff --git a/src/WireMock.Net.Minimal/Http/HttpClientBuilder.cs b/src/WireMock.Net.Minimal/Http/HttpClientBuilder.cs
index 275b7b57..c8523b7f 100644
--- a/src/WireMock.Net.Minimal/Http/HttpClientBuilder.cs
+++ b/src/WireMock.Net.Minimal/Http/HttpClientBuilder.cs
@@ -11,24 +11,18 @@ internal static class HttpClientBuilder
{
public static HttpClient Build(HttpClientSettings settings)
{
-#if NETSTANDARD || NETCOREAPP3_1 || NET5_0_OR_GREATER
+#if NET8_0_OR_GREATER
var handler = new HttpClientHandler
{
CheckCertificateRevocationList = false,
SslProtocols = System.Security.Authentication.SslProtocols.Tls12 | System.Security.Authentication.SslProtocols.Tls11 | System.Security.Authentication.SslProtocols.Tls,
- ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => true,
- AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
- };
-#elif NET46
- var handler = new HttpClientHandler
- {
- ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => true,
+ ServerCertificateCustomValidationCallback = (_, _, _, _) => true,
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
};
#else
- var handler = new WebRequestHandler
+ var handler = new HttpClientHandler
{
- ServerCertificateValidationCallback = (sender, certificate, chain, errors) => true,
+ ServerCertificateCustomValidationCallback = (_, _, _, _) => true,
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
};
#endif
diff --git a/src/WireMock.Net.Minimal/Owin/AspNetCoreSelfHost.NETCore.cs b/src/WireMock.Net.Minimal/Owin/AspNetCoreSelfHost.Cors.cs
similarity index 97%
rename from src/WireMock.Net.Minimal/Owin/AspNetCoreSelfHost.NETCore.cs
rename to src/WireMock.Net.Minimal/Owin/AspNetCoreSelfHost.Cors.cs
index c687c17b..9f5b5d0d 100644
--- a/src/WireMock.Net.Minimal/Owin/AspNetCoreSelfHost.NETCore.cs
+++ b/src/WireMock.Net.Minimal/Owin/AspNetCoreSelfHost.Cors.cs
@@ -1,6 +1,6 @@
// Copyright © WireMock.Net
-#if NETCOREAPP3_1 || NET5_0_OR_GREATER
+#if NET8_0
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using WireMock.Types;
diff --git a/src/WireMock.Net.Minimal/Owin/AspNetCoreSelfHost.NETStandard.cs b/src/WireMock.Net.Minimal/Owin/AspNetCoreSelfHost.NETStandard.cs
index 981ef04e..68539fb8 100644
--- a/src/WireMock.Net.Minimal/Owin/AspNetCoreSelfHost.NETStandard.cs
+++ b/src/WireMock.Net.Minimal/Owin/AspNetCoreSelfHost.NETStandard.cs
@@ -1,12 +1,11 @@
// Copyright © WireMock.Net
-#if USE_ASPNETCORE && !NETSTANDARD1_3
+//#if USE_ASPNETCORE && !NETSTANDARD1_3
using System;
using System.Collections.Generic;
using System.Net;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Server.Kestrel.Core;
-using Microsoft.AspNetCore.Server.Kestrel.Https;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using CertificateLoader = WireMock.HttpsCertificate.CertificateLoader;
@@ -38,7 +37,7 @@ internal partial class AspNetCoreSelfHost
options.ServerCertificate = CertificateLoader.LoadCertificate(wireMockMiddlewareOptions, urlDetail.Host);
}
- options.ClientCertificateMode = (ClientCertificateMode)wireMockMiddlewareOptions.ClientCertificateMode;
+ options.ClientCertificateMode = wireMockMiddlewareOptions.ClientCertificateMode;
if (wireMockMiddlewareOptions.AcceptAnyClientCertificate)
{
options.ClientCertificateValidation = (_, _, _) => true;
@@ -47,7 +46,7 @@ internal partial class AspNetCoreSelfHost
if (urlDetail.IsHttp2)
{
- listenOptions.Protocols = HttpProtocols.Http2;
+ SetHttp2AsProtocolsOnListenOptions(listenOptions);
}
});
continue;
@@ -55,10 +54,7 @@ internal partial class AspNetCoreSelfHost
if (urlDetail.IsHttp2)
{
- Listen(kestrelOptions, urlDetail, listenOptions =>
- {
- listenOptions.Protocols = HttpProtocols.Http2;
- });
+ Listen(kestrelOptions, urlDetail, SetHttp2AsProtocolsOnListenOptions);
continue;
}
@@ -66,6 +62,15 @@ internal partial class AspNetCoreSelfHost
}
}
+ private static void SetHttp2AsProtocolsOnListenOptions(ListenOptions listenOptions)
+ {
+#if NET8_0_OR_GREATER
+ listenOptions.Protocols = HttpProtocols.Http2;
+#else
+ throw new NotSupportedException("HTTP/2 is only supported in .NET 8 or greater.");
+#endif
+ }
+
private static void Listen(KestrelServerOptions kestrelOptions, HostUrlDetails urlDetail, Action configure)
{
// Listens on any IP with the given port.
@@ -112,4 +117,4 @@ internal static class IWebHostBuilderExtensions
});
}
}
-#endif
\ No newline at end of file
+//#endif
\ No newline at end of file
diff --git a/src/WireMock.Net.Minimal/Owin/AspNetCoreSelfHost.NETStandard13.cs b/src/WireMock.Net.Minimal/Owin/AspNetCoreSelfHost.NETStandard13.cs
index 9e04420c..60522b96 100644
--- a/src/WireMock.Net.Minimal/Owin/AspNetCoreSelfHost.NETStandard13.cs
+++ b/src/WireMock.Net.Minimal/Owin/AspNetCoreSelfHost.NETStandard13.cs
@@ -1,57 +1,57 @@
// Copyright © WireMock.Net
-#if USE_ASPNETCORE && NETSTANDARD1_3
-using System.Collections.Generic;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.AspNetCore.Server.Kestrel;
-using Microsoft.AspNetCore.Server.Kestrel.Https;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.DependencyInjection;
-using WireMock.HttpsCertificate;
+//#if USE_ASPNETCORE && NETSTANDARD1_3
+//using System.Collections.Generic;
+//using Microsoft.AspNetCore.Hosting;
+//using Microsoft.AspNetCore.Server.Kestrel;
+//using Microsoft.AspNetCore.Server.Kestrel.Https;
+//using Microsoft.Extensions.Configuration;
+//using Microsoft.Extensions.DependencyInjection;
+//using WireMock.HttpsCertificate;
-namespace WireMock.Owin;
+//namespace WireMock.Owin;
-internal partial class AspNetCoreSelfHost
-{
- private static void SetKestrelOptionsLimits(KestrelServerOptions options)
- {
- options.Limits.MaxRequestBufferSize = null;
- options.Limits.MaxRequestHeaderCount = 100;
- options.Limits.MaxResponseBufferSize = null;
- }
+//internal partial class AspNetCoreSelfHost
+//{
+// private static void SetKestrelOptionsLimits(KestrelServerOptions options)
+// {
+// options.Limits.MaxRequestBufferSize = null;
+// options.Limits.MaxRequestHeaderCount = 100;
+// options.Limits.MaxResponseBufferSize = null;
+// }
- private static void SetHttpsAndUrls(KestrelServerOptions options, IWireMockMiddlewareOptions wireMockMiddlewareOptions, IEnumerable urlDetails)
- {
- foreach (var urlDetail in urlDetails)
- {
- if (urlDetail.IsHttps)
- {
- options.UseHttps(new HttpsConnectionFilterOptions
- {
- ServerCertificate = wireMockMiddlewareOptions.CustomCertificateDefined ? CertificateLoader.LoadCertificate(wireMockMiddlewareOptions, urlDetail.Host) : PublicCertificateHelper.GetX509Certificate2(),
- ClientCertificateMode = (ClientCertificateMode) wireMockMiddlewareOptions.ClientCertificateMode,
- ClientCertificateValidation = wireMockMiddlewareOptions.AcceptAnyClientCertificate ? (_, _, _) => true : null
- });
- }
- }
- }
-}
+// private static void SetHttpsAndUrls(KestrelServerOptions options, IWireMockMiddlewareOptions wireMockMiddlewareOptions, IEnumerable urlDetails)
+// {
+// foreach (var urlDetail in urlDetails)
+// {
+// if (urlDetail.IsHttps)
+// {
+// options.UseHttps(new HttpsConnectionFilterOptions
+// {
+// ServerCertificate = wireMockMiddlewareOptions.CustomCertificateDefined ? CertificateLoader.LoadCertificate(wireMockMiddlewareOptions, urlDetail.Host) : PublicCertificateHelper.GetX509Certificate2(),
+// ClientCertificateMode = (ClientCertificateMode) wireMockMiddlewareOptions.ClientCertificateMode,
+// ClientCertificateValidation = wireMockMiddlewareOptions.AcceptAnyClientCertificate ? (_, _, _) => true : null
+// });
+// }
+// }
+// }
+//}
-internal static class IWebHostBuilderExtensions
-{
- internal static IWebHostBuilder ConfigureAppConfigurationUsingEnvironmentVariables(this IWebHostBuilder builder) => builder;
+//internal static class IWebHostBuilderExtensions
+//{
+// internal static IWebHostBuilder ConfigureAppConfigurationUsingEnvironmentVariables(this IWebHostBuilder builder) => builder;
- internal static IWebHostBuilder ConfigureKestrelServerOptions(this IWebHostBuilder builder)
- {
- var configuration = new ConfigurationBuilder()
- .AddEnvironmentVariables()
- .Build();
+// internal static IWebHostBuilder ConfigureKestrelServerOptions(this IWebHostBuilder builder)
+// {
+// var configuration = new ConfigurationBuilder()
+// .AddEnvironmentVariables()
+// .Build();
- return builder.ConfigureServices(services =>
- {
- services.Configure(configuration.GetSection("Kestrel"));
- });
- }
-}
+// return builder.ConfigureServices(services =>
+// {
+// services.Configure(configuration.GetSection("Kestrel"));
+// });
+// }
+//}
-#endif
\ No newline at end of file
+//#endif
\ No newline at end of file
diff --git a/src/WireMock.Net.Minimal/Owin/AspNetCoreSelfHost.cs b/src/WireMock.Net.Minimal/Owin/AspNetCoreSelfHost.cs
index 7ce3c14d..1ca1b0fd 100644
--- a/src/WireMock.Net.Minimal/Owin/AspNetCoreSelfHost.cs
+++ b/src/WireMock.Net.Minimal/Owin/AspNetCoreSelfHost.cs
@@ -1,10 +1,9 @@
// Copyright © WireMock.Net
-#if USE_ASPNETCORE
+//#if USE_ASPNETCORE
using System;
using System.Collections.Generic;
using System.IO;
-using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
@@ -74,7 +73,7 @@ internal partial class AspNetCoreSelfHost : IOwinSelfHost
services.AddSingleton();
services.AddSingleton();
-#if NETCOREAPP3_1 || NET5_0_OR_GREATER
+#if NET8_0_OR_GREATER
AddCors(services);
#endif
_wireMockMiddlewareOptions.AdditionalServiceRegistration?.Invoke(services);
@@ -83,7 +82,7 @@ internal partial class AspNetCoreSelfHost : IOwinSelfHost
{
appBuilder.UseMiddleware();
-#if NETCOREAPP3_1 || NET5_0_OR_GREATER
+#if NET8_0_OR_GREATER
UseCors(appBuilder);
#endif
_wireMockMiddlewareOptions.PreWireMockMiddlewareInit?.Invoke(appBuilder);
@@ -100,9 +99,9 @@ internal partial class AspNetCoreSelfHost : IOwinSelfHost
})
.ConfigureKestrelServerOptions()
-#if NETSTANDARD1_3
- .UseUrls(_urlOptions.GetDetails().Select(u => u.Url).ToArray())
-#endif
+//#if NETSTANDARD1_3
+// .UseUrls(_urlOptions.GetDetails().Select(u => u.Url).ToArray())
+//#endif
.Build();
return RunHost(_cts.Token);
@@ -112,7 +111,7 @@ internal partial class AspNetCoreSelfHost : IOwinSelfHost
{
try
{
-#if NETCOREAPP3_1 || NET5_0_OR_GREATER
+#if NET8_0_OR_GREATER
var appLifetime = _host.Services.GetRequiredService();
#else
var appLifetime = _host.Services.GetRequiredService();
@@ -134,23 +133,9 @@ internal partial class AspNetCoreSelfHost : IOwinSelfHost
IsStarted = true;
});
-#if NETSTANDARD1_3
- _logger.Info("Server using netstandard1.3");
-#elif NETSTANDARD2_0
- _logger.Info("Server using netstandard2.0");
-#elif NETSTANDARD2_1
- _logger.Info("Server using netstandard2.1");
-#elif NETCOREAPP3_1
- _logger.Info("Server using .NET Core App 3.1");
-#elif NET5_0
- _logger.Info("Server using .NET 5.0");
-#elif NET6_0
- _logger.Info("Server using .NET 6.0");
-#elif NET7_0
- _logger.Info("Server using .NET 7.0");
-#elif NET8_0
+#if NET8_0
_logger.Info("Server using .NET 8.0");
-#elif NET46
+#elif NET48
_logger.Info("Server using .NET Framework 4.6.1 or higher");
#endif
@@ -179,11 +164,11 @@ internal partial class AspNetCoreSelfHost : IOwinSelfHost
_cts.Cancel();
IsStarted = false;
-#if NETSTANDARD1_3
- return Task.CompletedTask;
-#else
+//#if NETSTANDARD1_3
+// return Task.CompletedTask;
+//#else
return _host.StopAsync();
-#endif
+//#endif
}
}
-#endif
\ No newline at end of file
+//#endif
\ No newline at end of file
diff --git a/src/WireMock.Net.Minimal/Owin/GlobalExceptionMiddleware.cs b/src/WireMock.Net.Minimal/Owin/GlobalExceptionMiddleware.cs
index 516484df..e1b15a38 100644
--- a/src/WireMock.Net.Minimal/Owin/GlobalExceptionMiddleware.cs
+++ b/src/WireMock.Net.Minimal/Owin/GlobalExceptionMiddleware.cs
@@ -3,68 +3,69 @@
using System;
using System.Threading.Tasks;
using Newtonsoft.Json;
-#if !USE_ASPNETCORE
-using Microsoft.Owin;
-using IContext = Microsoft.Owin.IOwinContext;
-using OwinMiddleware = Microsoft.Owin.OwinMiddleware;
-using Next = Microsoft.Owin.OwinMiddleware;
-#else
-using OwinMiddleware = System.Object;
-using IContext = Microsoft.AspNetCore.Http.HttpContext;
-using Next = Microsoft.AspNetCore.Http.RequestDelegate;
-#endif
using WireMock.Owin.Mappers;
using Stef.Validation;
+using Microsoft.AspNetCore.Http;
+//#if !USE_ASPNETCORE
+//using Microsoft.Owin;
+//using IContext = Microsoft.Owin.IOwinContext;
+//using OwinMiddleware = Microsoft.Owin.OwinMiddleware;
+//using Next = Microsoft.Owin.OwinMiddleware;
+//#else
+//using OwinMiddleware = System.Object;
+//using IContext = Microsoft.AspNetCore.Http.HttpContext;
+//using Next = Microsoft.AspNetCore.Http.RequestDelegate;
+//#endif
-namespace WireMock.Owin
+
+namespace WireMock.Owin;
+
+internal class GlobalExceptionMiddleware //: OwinMiddleware
{
- internal class GlobalExceptionMiddleware : OwinMiddleware
+ private readonly IWireMockMiddlewareOptions _options;
+ private readonly IOwinResponseMapper _responseMapper;
+
+//#if !USE_ASPNETCORE
+// public GlobalExceptionMiddleware(Next next, IWireMockMiddlewareOptions options, IOwinResponseMapper responseMapper) : base(next)
+// {
+// _options = Guard.NotNull(options);
+// _responseMapper = Guard.NotNull(responseMapper);;
+// }
+//#else
+ public GlobalExceptionMiddleware(RequestDelegate next, IWireMockMiddlewareOptions options, IOwinResponseMapper responseMapper)
{
- private readonly IWireMockMiddlewareOptions _options;
- private readonly IOwinResponseMapper _responseMapper;
+ Next = next;
+ _options = Guard.NotNull(options);
+ _responseMapper = Guard.NotNull(responseMapper);
+ }
+//#endif
-#if !USE_ASPNETCORE
- public GlobalExceptionMiddleware(Next next, IWireMockMiddlewareOptions options, IOwinResponseMapper responseMapper) : base(next)
- {
- _options = Guard.NotNull(options);
- _responseMapper = Guard.NotNull(responseMapper);;
- }
-#else
- public GlobalExceptionMiddleware(Next next, IWireMockMiddlewareOptions options, IOwinResponseMapper responseMapper)
- {
- Next = next;
- _options = Guard.NotNull(options);
- _responseMapper = Guard.NotNull(responseMapper);
- }
-#endif
+//#if USE_ASPNETCORE
+ public RequestDelegate? Next { get; }
+//#endif
-#if USE_ASPNETCORE
- public Next Next { get; }
-#endif
+//#if !USE_ASPNETCORE
+// public override Task Invoke(IContext ctx)
+//#else
+ public Task Invoke(HttpContext ctx)
+//#endif
+ {
+ return InvokeInternalAsync(ctx);
+ }
-#if !USE_ASPNETCORE
- public override Task Invoke(IContext ctx)
-#else
- public Task Invoke(IContext ctx)
-#endif
+ private async Task InvokeInternalAsync(HttpContext ctx)
+ {
+ try
{
- return InvokeInternalAsync(ctx);
- }
-
- private async Task InvokeInternalAsync(IContext ctx)
- {
- try
+ if (Next != null)
{
- if (Next != null)
- {
- await Next.Invoke(ctx).ConfigureAwait(false);
- }
- }
- catch (Exception ex)
- {
- _options.Logger.Error("HttpStatusCode set to 500 {0}", ex);
- await _responseMapper.MapAsync(ResponseMessageBuilder.Create(500, JsonConvert.SerializeObject(ex)), ctx.Response).ConfigureAwait(false);
+ await Next.Invoke(ctx).ConfigureAwait(false);
}
}
+ catch (Exception ex)
+ {
+ _options.Logger.Error("HttpStatusCode set to 500 {0}", ex);
+ await _responseMapper.MapAsync(ResponseMessageBuilder.Create(500, JsonConvert.SerializeObject(ex)), ctx.Response).ConfigureAwait(false);
+ }
}
-}
+}
\ No newline at end of file
diff --git a/src/WireMock.Net.Minimal/Owin/IWireMockMiddlewareOptions.cs b/src/WireMock.Net.Minimal/Owin/IWireMockMiddlewareOptions.cs
index d6f4c7ee..d35141f9 100644
--- a/src/WireMock.Net.Minimal/Owin/IWireMockMiddlewareOptions.cs
+++ b/src/WireMock.Net.Minimal/Owin/IWireMockMiddlewareOptions.cs
@@ -2,21 +2,22 @@
using System;
using System.Collections.Concurrent;
+using System.Security.Cryptography.X509Certificates;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.Extensions.DependencyInjection;
using WireMock.Handlers;
using WireMock.Logging;
using WireMock.Matchers;
using WireMock.Types;
using WireMock.Util;
-using System.Security.Cryptography.X509Certificates;
+using ClientCertificateMode = Microsoft.AspNetCore.Server.Kestrel.Https.ClientCertificateMode;
-using JetBrains.Annotations;
-
-#if !USE_ASPNETCORE
-using Owin;
-#else
-using IAppBuilder = Microsoft.AspNetCore.Builder.IApplicationBuilder;
-using Microsoft.Extensions.DependencyInjection;
-#endif
+//#if !USE_ASPNETCORE
+//using Owin;
+//#else
+//using IAppBuilder = Microsoft.AspNetCore.Builder.IApplicationBuilder;
+//using Microsoft.Extensions.DependencyInjection;
+//#endif
namespace WireMock.Owin;
@@ -40,11 +41,11 @@ internal interface IWireMockMiddlewareOptions
int? MaxRequestLogCount { get; set; }
- Action? PreWireMockMiddlewareInit { get; set; }
+ Action? PreWireMockMiddlewareInit { get; set; }
- Action? PostWireMockMiddlewareInit { get; set; }
+ Action? PostWireMockMiddlewareInit { get; set; }
-#if USE_ASPNETCORE
+//#if USE_ASPNETCORE
Action? AdditionalServiceRegistration { get; set; }
CorsPolicyOptions? CorsPolicyOptions { get; set; }
@@ -52,7 +53,7 @@ internal interface IWireMockMiddlewareOptions
ClientCertificateMode ClientCertificateMode { get; set; }
bool AcceptAnyClientCertificate { get; set; }
-#endif
+//#endif
IFileSystemHandler? FileSystemHandler { get; set; }
diff --git a/src/WireMock.Net.Minimal/Owin/Mappers/IOwinRequestMapper.cs b/src/WireMock.Net.Minimal/Owin/Mappers/IOwinRequestMapper.cs
index f5e00598..94edbf11 100644
--- a/src/WireMock.Net.Minimal/Owin/Mappers/IOwinRequestMapper.cs
+++ b/src/WireMock.Net.Minimal/Owin/Mappers/IOwinRequestMapper.cs
@@ -1,25 +1,25 @@
// Copyright © WireMock.Net
using System.Threading.Tasks;
-#if !USE_ASPNETCORE
-using IRequest = Microsoft.Owin.IOwinRequest;
-#else
-using IRequest = Microsoft.AspNetCore.Http.HttpRequest;
-#endif
+using Microsoft.AspNetCore.Http;
+//#if !USE_ASPNETCORE
+//using IRequest = Microsoft.Owin.IOwinRequest;
+//#else
+//using IRequest = Microsoft.AspNetCore.Http.HttpRequest;
+//#endif
-namespace WireMock.Owin.Mappers
+namespace WireMock.Owin.Mappers;
+
+///
+/// IOwinRequestMapper
+///
+internal interface IOwinRequestMapper
{
///
- /// IOwinRequestMapper
+ /// MapAsync IRequest to RequestMessage
///
- internal interface IOwinRequestMapper
- {
- ///
- /// MapAsync IRequest to RequestMessage
- ///
- /// The OwinRequest/HttpRequest
- /// The WireMockMiddlewareOptions
- /// RequestMessage
- Task MapAsync(IRequest request, IWireMockMiddlewareOptions options);
- }
+ /// The HttpRequest
+ /// The WireMockMiddlewareOptions
+ /// RequestMessage
+ Task MapAsync(HttpRequest request, IWireMockMiddlewareOptions options);
}
\ No newline at end of file
diff --git a/src/WireMock.Net.Minimal/Owin/Mappers/IOwinResponseMapper.cs b/src/WireMock.Net.Minimal/Owin/Mappers/IOwinResponseMapper.cs
index 304361f7..bf5897a6 100644
--- a/src/WireMock.Net.Minimal/Owin/Mappers/IOwinResponseMapper.cs
+++ b/src/WireMock.Net.Minimal/Owin/Mappers/IOwinResponseMapper.cs
@@ -1,11 +1,13 @@
// Copyright © WireMock.Net
using System.Threading.Tasks;
-#if !USE_ASPNETCORE
-using IResponse = Microsoft.Owin.IOwinResponse;
-#else
-using IResponse = Microsoft.AspNetCore.Http.HttpResponse;
-#endif
+using Microsoft.AspNetCore.Http;
+
+//#if !USE_ASPNETCORE
+//using IResponse = Microsoft.Owin.IOwinResponse;
+//#else
+//using IResponse = Microsoft.AspNetCore.Http.HttpResponse;
+//#endif
namespace WireMock.Owin.Mappers;
@@ -18,6 +20,6 @@ internal interface IOwinResponseMapper
/// Map ResponseMessage to IResponse.
///
/// The ResponseMessage
- /// The OwinResponse/HttpResponse
- Task MapAsync(IResponseMessage? responseMessage, IResponse response);
-}
+ /// The HttpResponse
+ Task MapAsync(IResponseMessage? responseMessage, HttpResponse response);
+}
\ No newline at end of file
diff --git a/src/WireMock.Net.Minimal/Owin/Mappers/OwinRequestMapper.cs b/src/WireMock.Net.Minimal/Owin/Mappers/OwinRequestMapper.cs
index 02acc7f7..2f86b92f 100644
--- a/src/WireMock.Net.Minimal/Owin/Mappers/OwinRequestMapper.cs
+++ b/src/WireMock.Net.Minimal/Owin/Mappers/OwinRequestMapper.cs
@@ -4,15 +4,17 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Http.Extensions;
using WireMock.Http;
using WireMock.Models;
using WireMock.Util;
-#if !USE_ASPNETCORE
-using IRequest = Microsoft.Owin.IOwinRequest;
-#else
-using Microsoft.AspNetCore.Http.Extensions;
-using IRequest = Microsoft.AspNetCore.Http.HttpRequest;
-#endif
+//#if !USE_ASPNETCORE
+//using IRequest = Microsoft.Owin.IOwinRequest;
+//#else
+//using Microsoft.AspNetCore.Http.Extensions;
+//using IRequest = Microsoft.AspNetCore.Http.HttpRequest;
+//#endif
namespace WireMock.Owin.Mappers;
@@ -22,7 +24,7 @@ namespace WireMock.Owin.Mappers;
internal class OwinRequestMapper : IOwinRequestMapper
{
///
- public async Task MapAsync(IRequest request, IWireMockMiddlewareOptions options)
+ public async Task MapAsync(HttpRequest request, IWireMockMiddlewareOptions options)
{
var (urlDetails, clientIP) = ParseRequest(request);
@@ -83,12 +85,12 @@ internal class OwinRequestMapper : IOwinRequestMapper
};
}
- private static (UrlDetails UrlDetails, string ClientIP) ParseRequest(IRequest request)
+ private static (UrlDetails UrlDetails, string ClientIP) ParseRequest(HttpRequest request)
{
-#if !USE_ASPNETCORE
- var urlDetails = UrlUtils.Parse(request.Uri, request.PathBase);
- var clientIP = request.RemoteIpAddress;
-#else
+ //#if !USE_ASPNETCORE
+ // var urlDetails = UrlUtils.Parse(request.Uri, request.PathBase);
+ // var clientIP = request.RemoteIpAddress;
+ //#else
var urlDetails = UrlUtils.Parse(new Uri(request.GetEncodedUrl()), request.PathBase);
var connection = request.HttpContext.Connection;
@@ -105,7 +107,7 @@ internal class OwinRequestMapper : IOwinRequestMapper
{
clientIP = connection.RemoteIpAddress.ToString();
}
-#endif
+ //#endif
return (urlDetails, clientIP);
}
}
\ No newline at end of file
diff --git a/src/WireMock.Net.Minimal/Owin/Mappers/OwinResponseMapper.cs b/src/WireMock.Net.Minimal/Owin/Mappers/OwinResponseMapper.cs
index 1bb412d4..cb62cd06 100644
--- a/src/WireMock.Net.Minimal/Owin/Mappers/OwinResponseMapper.cs
+++ b/src/WireMock.Net.Minimal/Owin/Mappers/OwinResponseMapper.cs
@@ -8,21 +8,22 @@ using System.Net;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
+using Microsoft.AspNetCore.Http;
using Newtonsoft.Json;
using RandomDataGenerator.FieldOptions;
using RandomDataGenerator.Randomizers;
+using Stef.Validation;
using WireMock.Http;
using WireMock.ResponseBuilders;
using WireMock.Types;
-using Stef.Validation;
using WireMock.Util;
-#if !USE_ASPNETCORE
-using IResponse = Microsoft.Owin.IOwinResponse;
-#else
-using Microsoft.AspNetCore.Http;
-using IResponse = Microsoft.AspNetCore.Http.HttpResponse;
-#endif
+//#if !USE_ASPNETCORE
+//using IResponse = Microsoft.Owin.IOwinResponse;
+//#else
+//using Microsoft.AspNetCore.Http;
+//using IResponse = Microsoft.AspNetCore.Http.HttpResponse;
+//#endif
namespace WireMock.Owin.Mappers
{
@@ -37,8 +38,8 @@ namespace WireMock.Owin.Mappers
private readonly Encoding _utf8NoBom = new UTF8Encoding(false);
// https://msdn.microsoft.com/en-us/library/78h415ay(v=vs.110).aspx
- private static readonly IDictionary>> ResponseHeadersToFix =
- new Dictionary>>(StringComparer.OrdinalIgnoreCase)
+ private static readonly IDictionary>> ResponseHeadersToFix =
+ new Dictionary>>(StringComparer.OrdinalIgnoreCase)
{
{ HttpKnownHeaderNames.ContentType, (r, _, v) => r.ContentType = v.FirstOrDefault() },
{ HttpKnownHeaderNames.ContentLength, (r, hasBody, v) =>
@@ -62,7 +63,7 @@ namespace WireMock.Owin.Mappers
}
///
- public async Task MapAsync(IResponseMessage? responseMessage, IResponse response)
+ public async Task MapAsync(IResponseMessage? responseMessage, HttpResponse response)
{
if (responseMessage == null)
{
@@ -128,7 +129,7 @@ namespace WireMock.Owin.Mappers
SetResponseTrailingHeaders(responseMessage, response);
}
- private static async Task HandleSseStringAsync(IResponseMessage responseMessage, IResponse response, IBodyData bodyData)
+ private static async Task HandleSseStringAsync(IResponseMessage responseMessage, HttpResponse response, IBodyData bodyData)
{
if (bodyData.SseStringQueue == null)
{
@@ -199,7 +200,7 @@ namespace WireMock.Owin.Mappers
return null;
}
- private static void SetResponseHeaders(IResponseMessage responseMessage, bool hasBody, IResponse response)
+ private static void SetResponseHeaders(IResponseMessage responseMessage, bool hasBody, HttpResponse response)
{
// Force setting the Date header (#577)
AppendResponseHeader(
@@ -215,7 +216,7 @@ namespace WireMock.Owin.Mappers
var value = item.Value;
if (ResponseHeadersToFix.TryGetValue(headerName, out var action))
{
- action?.Invoke(response, hasBody, value);
+ action.Invoke(response, hasBody, value);
}
else
{
@@ -228,7 +229,7 @@ namespace WireMock.Owin.Mappers
}
}
- private static void SetResponseTrailingHeaders(IResponseMessage responseMessage, IResponse response)
+ private static void SetResponseTrailingHeaders(IResponseMessage responseMessage, HttpResponse response)
{
if (responseMessage.TrailingHeaders == null)
{
@@ -236,13 +237,11 @@ namespace WireMock.Owin.Mappers
}
#if TRAILINGHEADERS
- foreach (var item in responseMessage.TrailingHeaders)
+ foreach (var (headerName, value) in responseMessage.TrailingHeaders)
{
- var headerName = item.Key;
- var value = item.Value;
if (ResponseHeadersToFix.TryGetValue(headerName, out var action))
{
- action?.Invoke(response, false, value);
+ action.Invoke(response, false, value);
}
else
{
@@ -256,13 +255,13 @@ namespace WireMock.Owin.Mappers
#endif
}
- private static void AppendResponseHeader(IResponse response, string headerName, string[] values)
+ private static void AppendResponseHeader(HttpResponse response, string headerName, string[] values)
{
-#if !USE_ASPNETCORE
- response.Headers.AppendValues(headerName, values);
-#else
+ //#if !USE_ASPNETCORE
+ // response.Headers.AppendValues(headerName, values);
+ //#else
response.Headers.Append(headerName, values);
-#endif
+ //#endif
}
}
}
\ No newline at end of file
diff --git a/src/WireMock.Net.Minimal/Owin/OwinSelfHost.cs b/src/WireMock.Net.Minimal/Owin/OwinSelfHost.cs
index d9f8c537..cfd13022 100644
--- a/src/WireMock.Net.Minimal/Owin/OwinSelfHost.cs
+++ b/src/WireMock.Net.Minimal/Owin/OwinSelfHost.cs
@@ -1,114 +1,112 @@
// Copyright © WireMock.Net
-#if !USE_ASPNETCORE
-using Microsoft.Owin.Hosting;
-using Owin;
-using System;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-using JetBrains.Annotations;
-using WireMock.Logging;
-using WireMock.Owin.Mappers;
-using Stef.Validation;
-using WireMock.Services;
-using WireMock.Util;
+//using Microsoft.Owin.Hosting;
+//using Owin;
+//using System;
+//using System.Collections.Generic;
+//using System.Threading;
+//using System.Threading.Tasks;
+//using JetBrains.Annotations;
+//using WireMock.Logging;
+//using WireMock.Owin.Mappers;
+//using Stef.Validation;
+//using WireMock.Services;
+//using WireMock.Util;
-namespace WireMock.Owin;
+//namespace WireMock.Owin;
-internal class OwinSelfHost : IOwinSelfHost
-{
- private readonly IWireMockMiddlewareOptions _options;
- private readonly CancellationTokenSource _cts = new();
- private readonly IWireMockLogger _logger;
+//internal class OwinSelfHost : IOwinSelfHost
+//{
+// private readonly IWireMockMiddlewareOptions _options;
+// private readonly CancellationTokenSource _cts = new();
+// private readonly IWireMockLogger _logger;
- private Exception? _runningException;
+// private Exception? _runningException;
- public OwinSelfHost(IWireMockMiddlewareOptions options, HostUrlOptions urlOptions)
- {
- Guard.NotNull(urlOptions);
+// public OwinSelfHost(IWireMockMiddlewareOptions options, HostUrlOptions urlOptions)
+// {
+// Guard.NotNull(urlOptions);
- _options = Guard.NotNull(options);
- _logger = options.Logger ?? new WireMockConsoleLogger();
+// _options = Guard.NotNull(options);
+// _logger = options.Logger ?? new WireMockConsoleLogger();
- foreach (var detail in urlOptions.GetDetails())
- {
- Urls.Add(detail.Url);
- Ports.Add(detail.Port);
- }
- }
+// foreach (var detail in urlOptions.GetDetails())
+// {
+// Urls.Add(detail.Url);
+// Ports.Add(detail.Port);
+// }
+// }
- public bool IsStarted { get; private set; }
+// public bool IsStarted { get; private set; }
- public List Urls { get; } = new();
+// public List Urls { get; } = new();
- public List Ports { get; } = new();
+// public List Ports { get; } = new();
- public Exception? RunningException => _runningException;
+// public Exception? RunningException => _runningException;
- [PublicAPI]
- public Task StartAsync()
- {
- return Task.Run(StartServers, _cts.Token);
- }
+// [PublicAPI]
+// public Task StartAsync()
+// {
+// return Task.Run(StartServers, _cts.Token);
+// }
- [PublicAPI]
- public Task StopAsync()
- {
- _cts.Cancel();
+// [PublicAPI]
+// public Task StopAsync()
+// {
+// _cts.Cancel();
- return Task.FromResult(true);
- }
+// return Task.FromResult(true);
+// }
- private void StartServers()
- {
-#if NET46
- _logger.Info("Server using .net 4.6");
-#else
- _logger.Info("Server using .net 4.5.x");
-#endif
- var servers = new List();
+// private void StartServers()
+// {
+//#if NET46
+// _logger.Info("Server using .net 4.6");
+//#else
+// _logger.Info("Server using .net 4.5.x");
+//#endif
+// var servers = new List();
- try
- {
- var requestMapper = new OwinRequestMapper();
- var responseMapper = new OwinResponseMapper(_options);
- var matcher = new MappingMatcher(_options, new RandomizerDoubleBetween0And1());
- var guidUtils = new GuidUtils();
+// try
+// {
+// var requestMapper = new OwinRequestMapper();
+// var responseMapper = new OwinResponseMapper(_options);
+// var matcher = new MappingMatcher(_options, new RandomizerDoubleBetween0And1());
+// var guidUtils = new GuidUtils();
- Action startup = app =>
- {
- app.Use(_options, responseMapper);
- _options.PreWireMockMiddlewareInit?.Invoke(app);
- app.Use(_options, requestMapper, responseMapper, matcher, guidUtils);
- _options.PostWireMockMiddlewareInit?.Invoke(app);
- };
+// Action startup = app =>
+// {
+// app.Use(_options, responseMapper);
+// _options.PreWireMockMiddlewareInit?.Invoke(app);
+// app.Use(_options, requestMapper, responseMapper, matcher, guidUtils);
+// _options.PostWireMockMiddlewareInit?.Invoke(app);
+// };
- foreach (var url in Urls)
- {
- servers.Add(WebApp.Start(url, startup));
- }
+// foreach (var url in Urls)
+// {
+// servers.Add(WebApp.Start(url, startup));
+// }
- IsStarted = true;
+// IsStarted = true;
- // WaitHandle is signaled when the token is cancelled,
- // which will be more efficient than Thread.Sleep in while loop
- _cts.Token.WaitHandle.WaitOne();
- }
- catch (Exception e)
- {
- // Expose exception of starting host, otherwise it's hard to be troubleshooting if keeping quiet
- // For example, WebApp.Start will fail with System.MissingMemberException if Microsoft.Owin.Host.HttpListener.dll is being located
- // https://stackoverflow.com/questions/25090211/owin-httplistener-not-located/31369857
- _runningException = e;
- _logger.Error(e.ToString());
- }
- finally
- {
- IsStarted = false;
- // Dispose all servers in finally block to make sure clean up allocated resource on error happening
- servers.ForEach(s => s.Dispose());
- }
- }
-}
-#endif
\ No newline at end of file
+// // WaitHandle is signaled when the token is cancelled,
+// // which will be more efficient than Thread.Sleep in while loop
+// _cts.Token.WaitHandle.WaitOne();
+// }
+// catch (Exception e)
+// {
+// // Expose exception of starting host, otherwise it's hard to be troubleshooting if keeping quiet
+// // For example, WebApp.Start will fail with System.MissingMemberException if Microsoft.Owin.Host.HttpListener.dll is being located
+// // https://stackoverflow.com/questions/25090211/owin-httplistener-not-located/31369857
+// _runningException = e;
+// _logger.Error(e.ToString());
+// }
+// finally
+// {
+// IsStarted = false;
+// // Dispose all servers in finally block to make sure clean up allocated resource on error happening
+// servers.ForEach(s => s.Dispose());
+// }
+// }
+//}
\ No newline at end of file
diff --git a/src/WireMock.Net.Minimal/Owin/WireMockMiddleware.cs b/src/WireMock.Net.Minimal/Owin/WireMockMiddleware.cs
index a67e6b70..1d2a7825 100644
--- a/src/WireMock.Net.Minimal/Owin/WireMockMiddleware.cs
+++ b/src/WireMock.Net.Minimal/Owin/WireMockMiddleware.cs
@@ -1,368 +1,368 @@
// Copyright © WireMock.Net
using System;
-using System.Threading.Tasks;
+using System.Collections.Generic;
using System.Linq;
using System.Net;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Http;
using Stef.Validation;
-using WireMock.Logging;
-using WireMock.Matchers;
-using WireMock.Http;
-using WireMock.Owin.Mappers;
-using WireMock.Serialization;
-using WireMock.ResponseBuilders;
-using WireMock.Settings;
-using System.Collections.Generic;
using WireMock.Constants;
using WireMock.Exceptions;
+using WireMock.Http;
+using WireMock.Logging;
+using WireMock.Matchers;
+using WireMock.Owin.Mappers;
+using WireMock.ResponseBuilders;
+using WireMock.Serialization;
+using WireMock.Settings;
using WireMock.Util;
-#if !USE_ASPNETCORE
-using IContext = Microsoft.Owin.IOwinContext;
-using OwinMiddleware = Microsoft.Owin.OwinMiddleware;
-using Next = Microsoft.Owin.OwinMiddleware;
-#else
-using OwinMiddleware = System.Object;
-using IContext = Microsoft.AspNetCore.Http.HttpContext;
-using Next = Microsoft.AspNetCore.Http.RequestDelegate;
-#endif
+//#if !USE_ASPNETCORE
+//using IContext = Microsoft.Owin.IOwinContext;
+//using OwinMiddleware = Microsoft.Owin.OwinMiddleware;
+//using Next = Microsoft.Owin.OwinMiddleware;
+//#else
+//using OwinMiddleware = System.Object;
+//using IContext = Microsoft.AspNetCore.Http.HttpContext;
+//using Next = Microsoft.AspNetCore.Http.RequestDelegate;
+//#endif
-namespace WireMock.Owin
+namespace WireMock.Owin;
+
+internal class WireMockMiddleware //: OwinMiddleware
{
- internal class WireMockMiddleware : OwinMiddleware
+ private readonly object _lock = new();
+ private static readonly Task CompletedTask = Task.FromResult(false);
+
+ private readonly IWireMockMiddlewareOptions _options;
+ private readonly IOwinRequestMapper _requestMapper;
+ private readonly IOwinResponseMapper _responseMapper;
+ private readonly IMappingMatcher _mappingMatcher;
+ private readonly LogEntryMapper _logEntryMapper;
+ private readonly IGuidUtils _guidUtils;
+
+ //#if !USE_ASPNETCORE
+ // public WireMockMiddleware(
+ // Next next,
+ // IWireMockMiddlewareOptions options,
+ // IOwinRequestMapper requestMapper,
+ // IOwinResponseMapper responseMapper,
+ // IMappingMatcher mappingMatcher,
+ // IGuidUtils guidUtils
+ // ) : base(next)
+ // {
+ // _options = Guard.NotNull(options);
+ // _requestMapper = Guard.NotNull(requestMapper);
+ // _responseMapper = Guard.NotNull(responseMapper);
+ // _mappingMatcher = Guard.NotNull(mappingMatcher);
+ // _logEntryMapper = new LogEntryMapper(options);
+ // _guidUtils = Guard.NotNull(guidUtils);
+ // }
+ //#else
+ public WireMockMiddleware(
+ RequestDelegate next,
+ IWireMockMiddlewareOptions options,
+ IOwinRequestMapper requestMapper,
+ IOwinResponseMapper responseMapper,
+ IMappingMatcher mappingMatcher,
+ IGuidUtils guidUtils
+ )
{
- private readonly object _lock = new();
- private static readonly Task CompletedTask = Task.FromResult(false);
+ _options = Guard.NotNull(options);
+ _requestMapper = Guard.NotNull(requestMapper);
+ _responseMapper = Guard.NotNull(responseMapper);
+ _mappingMatcher = Guard.NotNull(mappingMatcher);
+ _logEntryMapper = new LogEntryMapper(options);
+ _guidUtils = Guard.NotNull(guidUtils);
+ }
+ //#endif
- private readonly IWireMockMiddlewareOptions _options;
- private readonly IOwinRequestMapper _requestMapper;
- private readonly IOwinResponseMapper _responseMapper;
- private readonly IMappingMatcher _mappingMatcher;
- private readonly LogEntryMapper _logEntryMapper;
- private readonly IGuidUtils _guidUtils;
-
-#if !USE_ASPNETCORE
- public WireMockMiddleware(
- Next next,
- IWireMockMiddlewareOptions options,
- IOwinRequestMapper requestMapper,
- IOwinResponseMapper responseMapper,
- IMappingMatcher mappingMatcher,
- IGuidUtils guidUtils
- ) : base(next)
+ //#if !USE_ASPNETCORE
+ // public override Task Invoke(IContext ctx)
+ //#else
+ public Task Invoke(HttpContext ctx)
+ //#endif
+ {
+ if (_options.HandleRequestsSynchronously.GetValueOrDefault(false))
{
- _options = Guard.NotNull(options);
- _requestMapper = Guard.NotNull(requestMapper);
- _responseMapper = Guard.NotNull(responseMapper);
- _mappingMatcher = Guard.NotNull(mappingMatcher);
- _logEntryMapper = new LogEntryMapper(options);
- _guidUtils = Guard.NotNull(guidUtils);
- }
-#else
- public WireMockMiddleware(
- Next next,
- IWireMockMiddlewareOptions options,
- IOwinRequestMapper requestMapper,
- IOwinResponseMapper responseMapper,
- IMappingMatcher mappingMatcher,
- IGuidUtils guidUtils
- )
- {
- _options = Guard.NotNull(options);
- _requestMapper = Guard.NotNull(requestMapper);
- _responseMapper = Guard.NotNull(responseMapper);
- _mappingMatcher = Guard.NotNull(mappingMatcher);
- _logEntryMapper = new LogEntryMapper(options);
- _guidUtils = Guard.NotNull(guidUtils);
- }
-#endif
-
-#if !USE_ASPNETCORE
- public override Task Invoke(IContext ctx)
-#else
- public Task Invoke(IContext ctx)
-#endif
- {
- if (_options.HandleRequestsSynchronously.GetValueOrDefault(false))
+ lock (_lock)
{
- lock (_lock)
+ return InvokeInternalAsync(ctx);
+ }
+ }
+
+ return InvokeInternalAsync(ctx);
+ }
+
+ private async Task InvokeInternalAsync(HttpContext ctx)
+ {
+ var request = await _requestMapper.MapAsync(ctx.Request, _options).ConfigureAwait(false);
+
+ var logRequest = false;
+ IResponseMessage? response = null;
+ (MappingMatcherResult? Match, MappingMatcherResult? Partial) result = (null, null);
+
+ try
+ {
+ foreach (var mapping in _options.Mappings.Values)
+ {
+ if (mapping.Scenario is null)
{
- return InvokeInternalAsync(ctx);
+ continue;
+ }
+
+ // Set scenario start
+ if (!_options.Scenarios.ContainsKey(mapping.Scenario) && mapping.IsStartState)
+ {
+ _options.Scenarios.TryAdd(mapping.Scenario, new ScenarioState
+ {
+ Name = mapping.Scenario
+ });
}
}
- return InvokeInternalAsync(ctx);
- }
+ result = _mappingMatcher.FindBestMatch(request);
- private async Task InvokeInternalAsync(IContext ctx)
- {
- var request = await _requestMapper.MapAsync(ctx.Request, _options).ConfigureAwait(false);
-
- var logRequest = false;
- IResponseMessage? response = null;
- (MappingMatcherResult? Match, MappingMatcherResult? Partial) result = (null, null);
-
- try
+ var targetMapping = result.Match?.Mapping;
+ if (targetMapping == null)
{
- foreach (var mapping in _options.Mappings.Values)
+ logRequest = true;
+ _options.Logger.Warn("HttpStatusCode set to 404 : No matching mapping found");
+ response = ResponseMessageBuilder.Create(HttpStatusCode.NotFound, WireMockConstants.NoMatchingFound);
+ return;
+ }
+
+ logRequest = targetMapping.LogMapping;
+
+ if (targetMapping.IsAdminInterface && _options.AuthenticationMatcher != null && request.Headers != null)
+ {
+ var authorizationHeaderPresent = request.Headers.TryGetValue(HttpKnownHeaderNames.Authorization, out var authorization);
+ if (!authorizationHeaderPresent)
{
- if (mapping.Scenario is null)
- {
- continue;
- }
-
- // Set scenario start
- if (!_options.Scenarios.ContainsKey(mapping.Scenario) && mapping.IsStartState)
- {
- _options.Scenarios.TryAdd(mapping.Scenario, new ScenarioState
- {
- Name = mapping.Scenario
- });
- }
- }
-
- result = _mappingMatcher.FindBestMatch(request);
-
- var targetMapping = result.Match?.Mapping;
- if (targetMapping == null)
- {
- logRequest = true;
- _options.Logger.Warn("HttpStatusCode set to 404 : No matching mapping found");
- response = ResponseMessageBuilder.Create(HttpStatusCode.NotFound, WireMockConstants.NoMatchingFound);
+ _options.Logger.Error("HttpStatusCode set to 401, authorization header is missing.");
+ response = ResponseMessageBuilder.Create(HttpStatusCode.Unauthorized, null);
return;
}
- logRequest = targetMapping.LogMapping;
-
- if (targetMapping.IsAdminInterface && _options.AuthenticationMatcher != null && request.Headers != null)
+ var authorizationHeaderMatchResult = _options.AuthenticationMatcher.IsMatch(authorization!.ToString());
+ if (!MatchScores.IsPerfect(authorizationHeaderMatchResult.Score))
{
- var authorizationHeaderPresent = request.Headers.TryGetValue(HttpKnownHeaderNames.Authorization, out var authorization);
- if (!authorizationHeaderPresent)
- {
- _options.Logger.Error("HttpStatusCode set to 401, authorization header is missing.");
- response = ResponseMessageBuilder.Create(HttpStatusCode.Unauthorized, null);
- return;
- }
+ _options.Logger.Error("HttpStatusCode set to 401, authentication failed.", authorizationHeaderMatchResult.Exception ?? throw new WireMockException("Authentication failed"));
+ response = ResponseMessageBuilder.Create(HttpStatusCode.Unauthorized, null);
+ return;
+ }
+ }
- var authorizationHeaderMatchResult = _options.AuthenticationMatcher.IsMatch(authorization!.ToString());
- if (!MatchScores.IsPerfect(authorizationHeaderMatchResult.Score))
- {
- _options.Logger.Error("HttpStatusCode set to 401, authentication failed.", authorizationHeaderMatchResult.Exception ?? throw new WireMockException("Authentication failed"));
- response = ResponseMessageBuilder.Create(HttpStatusCode.Unauthorized, null);
- return;
- }
+ if (!targetMapping.IsAdminInterface && _options.RequestProcessingDelay > TimeSpan.Zero)
+ {
+ await Task.Delay(_options.RequestProcessingDelay.Value).ConfigureAwait(false);
+ }
+
+ var (theResponse, theOptionalNewMapping) = await targetMapping.ProvideResponseAsync(request).ConfigureAwait(false);
+ response = theResponse;
+
+ var responseBuilder = targetMapping.Provider as Response;
+
+ if (!targetMapping.IsAdminInterface && theOptionalNewMapping != null)
+ {
+ if (responseBuilder?.ProxyAndRecordSettings?.SaveMapping == true || targetMapping.Settings.ProxyAndRecordSettings?.SaveMapping == true)
+ {
+ _options.Mappings.TryAdd(theOptionalNewMapping.Guid, theOptionalNewMapping);
}
- if (!targetMapping.IsAdminInterface && _options.RequestProcessingDelay > TimeSpan.Zero)
+ if (responseBuilder?.ProxyAndRecordSettings?.SaveMappingToFile == true || targetMapping.Settings.ProxyAndRecordSettings?.SaveMappingToFile == true)
{
- await Task.Delay(_options.RequestProcessingDelay.Value).ConfigureAwait(false);
+ var matcherMapper = new MatcherMapper(targetMapping.Settings);
+ var mappingConverter = new MappingConverter(matcherMapper);
+ var mappingToFileSaver = new MappingToFileSaver(targetMapping.Settings, mappingConverter);
+
+ mappingToFileSaver.SaveMappingToFile(theOptionalNewMapping);
}
+ }
- var (theResponse, theOptionalNewMapping) = await targetMapping.ProvideResponseAsync(request).ConfigureAwait(false);
- response = theResponse;
+ if (targetMapping.Scenario != null)
+ {
+ UpdateScenarioState(targetMapping);
+ }
- var responseBuilder = targetMapping.Provider as Response;
+ if (!targetMapping.IsAdminInterface && targetMapping.Webhooks?.Length > 0)
+ {
+ await SendToWebhooksAsync(targetMapping, request, response).ConfigureAwait(false);
+ }
+ }
+ catch (Exception ex)
+ {
+ _options.Logger.Error($"Providing a Response for Mapping '{result.Match?.Mapping.Guid}' failed. HttpStatusCode set to 500. Exception: {ex}");
+ response = ResponseMessageBuilder.Create(500, ex.Message);
+ }
+ finally
+ {
+ var log = new LogEntry
+ {
+ Guid = _guidUtils.NewGuid(),
+ RequestMessage = request,
+ ResponseMessage = response,
- if (!targetMapping.IsAdminInterface && theOptionalNewMapping != null)
+ MappingGuid = result.Match?.Mapping?.Guid,
+ MappingTitle = result.Match?.Mapping?.Title,
+ RequestMatchResult = result.Match?.RequestMatchResult,
+
+ PartialMappingGuid = result.Partial?.Mapping?.Guid,
+ PartialMappingTitle = result.Partial?.Mapping?.Title,
+ PartialMatchResult = result.Partial?.RequestMatchResult
+ };
+
+ LogRequest(log, logRequest);
+
+ try
+ {
+ if (_options.SaveUnmatchedRequests == true && result.Match?.RequestMatchResult is not { IsPerfectMatch: true })
{
- if (responseBuilder?.ProxyAndRecordSettings?.SaveMapping == true || targetMapping.Settings.ProxyAndRecordSettings?.SaveMapping == true)
- {
- _options.Mappings.TryAdd(theOptionalNewMapping.Guid, theOptionalNewMapping);
- }
-
- if (responseBuilder?.ProxyAndRecordSettings?.SaveMappingToFile == true || targetMapping.Settings.ProxyAndRecordSettings?.SaveMappingToFile == true)
- {
- var matcherMapper = new MatcherMapper(targetMapping.Settings);
- var mappingConverter = new MappingConverter(matcherMapper);
- var mappingToFileSaver = new MappingToFileSaver(targetMapping.Settings, mappingConverter);
-
- mappingToFileSaver.SaveMappingToFile(theOptionalNewMapping);
- }
+ var filename = $"{log.Guid}.LogEntry.json";
+ _options.FileSystemHandler?.WriteUnmatchedRequest(filename, JsonUtils.Serialize(log));
}
+ }
+ catch
+ {
+ // Empty catch
+ }
- if (targetMapping.Scenario != null)
- {
- UpdateScenarioState(targetMapping);
- }
-
- if (!targetMapping.IsAdminInterface && targetMapping.Webhooks?.Length > 0)
- {
- await SendToWebhooksAsync(targetMapping, request, response).ConfigureAwait(false);
- }
+ try
+ {
+ await _responseMapper.MapAsync(response, ctx.Response).ConfigureAwait(false);
}
catch (Exception ex)
{
- _options.Logger.Error($"Providing a Response for Mapping '{result.Match?.Mapping.Guid}' failed. HttpStatusCode set to 500. Exception: {ex}");
- response = ResponseMessageBuilder.Create(500, ex.Message);
+ _options.Logger.Error("HttpStatusCode set to 404 : No matching mapping found", ex);
+
+ var notFoundResponse = ResponseMessageBuilder.Create(HttpStatusCode.NotFound, WireMockConstants.NoMatchingFound);
+ await _responseMapper.MapAsync(notFoundResponse, ctx.Response).ConfigureAwait(false);
}
- finally
+ }
+
+ await CompletedTask.ConfigureAwait(false);
+ }
+
+ private async Task SendToWebhooksAsync(IMapping mapping, IRequestMessage request, IResponseMessage response)
+ {
+ var tasks = new List>();
+ for (int index = 0; index < mapping.Webhooks?.Length; index++)
+ {
+ var httpClientForWebhook = HttpClientBuilder.Build(mapping.Settings.WebhookSettings ?? new WebhookSettings());
+ var webhookSender = new WebhookSender(mapping.Settings);
+ var webhookRequest = mapping.Webhooks[index].Request;
+ var webHookIndex = index;
+
+ tasks.Add(async () =>
{
- var log = new LogEntry
- {
- Guid = _guidUtils.NewGuid(),
- RequestMessage = request,
- ResponseMessage = response,
-
- MappingGuid = result.Match?.Mapping?.Guid,
- MappingTitle = result.Match?.Mapping?.Title,
- RequestMatchResult = result.Match?.RequestMatchResult,
-
- PartialMappingGuid = result.Partial?.Mapping?.Guid,
- PartialMappingTitle = result.Partial?.Mapping?.Title,
- PartialMatchResult = result.Partial?.RequestMatchResult
- };
-
- LogRequest(log, logRequest);
-
try
{
- if (_options.SaveUnmatchedRequests == true && result.Match?.RequestMatchResult is not { IsPerfectMatch: true })
+ var result = await webhookSender.SendAsync(httpClientForWebhook, mapping, webhookRequest, request, response).ConfigureAwait(false);
+ if (!result.IsSuccessStatusCode)
{
- var filename = $"{log.Guid}.LogEntry.json";
- _options.FileSystemHandler?.WriteUnmatchedRequest(filename, JsonUtils.Serialize(log));
+ var content = await result.Content.ReadAsStringAsync().ConfigureAwait(false);
+ _options.Logger.Warn($"Sending message to Webhook [{webHookIndex}] from Mapping '{mapping.Guid}' failed. HttpStatusCode: {result.StatusCode} Content: {content}");
}
}
- catch
- {
- // Empty catch
- }
-
- try
- {
- await _responseMapper.MapAsync(response, ctx.Response).ConfigureAwait(false);
- }
catch (Exception ex)
{
- _options.Logger.Error("HttpStatusCode set to 404 : No matching mapping found", ex);
-
- var notFoundResponse = ResponseMessageBuilder.Create(HttpStatusCode.NotFound, WireMockConstants.NoMatchingFound);
- await _responseMapper.MapAsync(notFoundResponse, ctx.Response).ConfigureAwait(false);
+ _options.Logger.Error($"Sending message to Webhook [{webHookIndex}] from Mapping '{mapping.Guid}' failed. Exception: {ex}");
}
- }
-
- await CompletedTask.ConfigureAwait(false);
+ });
}
- private async Task SendToWebhooksAsync(IMapping mapping, IRequestMessage request, IResponseMessage response)
+ if (mapping.UseWebhooksFireAndForget == true)
{
- var tasks = new List>();
- for (int index = 0; index < mapping.Webhooks?.Length; index++)
+ try
{
- var httpClientForWebhook = HttpClientBuilder.Build(mapping.Settings.WebhookSettings ?? new WebhookSettings());
- var webhookSender = new WebhookSender(mapping.Settings);
- var webhookRequest = mapping.Webhooks[index].Request;
- var webHookIndex = index;
-
- tasks.Add(async () =>
+ // Do not wait
+ await Task.Run(() =>
{
- try
- {
- var result = await webhookSender.SendAsync(httpClientForWebhook, mapping, webhookRequest, request, response).ConfigureAwait(false);
- if (!result.IsSuccessStatusCode)
- {
- var content = await result.Content.ReadAsStringAsync().ConfigureAwait(false);
- _options.Logger.Warn($"Sending message to Webhook [{webHookIndex}] from Mapping '{mapping.Guid}' failed. HttpStatusCode: {result.StatusCode} Content: {content}");
- }
- }
- catch (Exception ex)
- {
- _options.Logger.Error($"Sending message to Webhook [{webHookIndex}] from Mapping '{mapping.Guid}' failed. Exception: {ex}");
- }
+ Task.WhenAll(tasks.Select(async task => await task.Invoke())).ConfigureAwait(false);
});
}
-
- if (mapping.UseWebhooksFireAndForget == true)
- {
- try
- {
- // Do not wait
- await Task.Run(() =>
- {
- Task.WhenAll(tasks.Select(async task => await task.Invoke())).ConfigureAwait(false);
- });
- }
- catch
- {
- // Ignore
- }
- }
- else
- {
- await Task.WhenAll(tasks.Select(async task => await task.Invoke())).ConfigureAwait(false);
- }
- }
-
- private void UpdateScenarioState(IMapping mapping)
- {
- var scenario = _options.Scenarios[mapping.Scenario!];
-
- // Increase the number of times this state has been executed
- scenario.Counter++;
-
- // Only if the number of times this state is executed equals the required StateTimes, proceed to next state and reset the counter to 0
- if (scenario.Counter == (mapping.TimesInSameState ?? 1))
- {
- scenario.NextState = mapping.NextState;
- scenario.Counter = 0;
- }
-
- // Else just update Started and Finished
- scenario.Started = true;
- scenario.Finished = mapping.NextState == null;
- }
-
- private void LogRequest(LogEntry entry, bool addRequest)
- {
- _options.Logger.DebugRequestResponse(_logEntryMapper.Map(entry), entry.RequestMessage.Path.StartsWith("/__admin/"));
-
- // If addRequest is set to true and MaxRequestLogCount is null or does have a value greater than 0, try to add a new request log.
- if (addRequest && _options.MaxRequestLogCount is null or > 0)
- {
- TryAddLogEntry(entry);
- }
-
- // In case MaxRequestLogCount has a value greater than 0, try to delete existing request logs based on the count.
- if (_options.MaxRequestLogCount is > 0)
- {
- var logEntries = _options.LogEntries.ToList();
- foreach (var logEntry in logEntries.OrderBy(le => le.RequestMessage.DateTime).Take(logEntries.Count - _options.MaxRequestLogCount.Value))
- {
- TryRemoveLogEntry(logEntry);
- }
- }
-
- // In case RequestLogExpirationDuration has a value greater than 0, try to delete existing request logs based on the date.
- if (_options.RequestLogExpirationDuration is > 0)
- {
- var checkTime = DateTime.UtcNow.AddHours(-_options.RequestLogExpirationDuration.Value);
- foreach (var logEntry in _options.LogEntries.ToList().Where(le => le.RequestMessage.DateTime < checkTime))
- {
- TryRemoveLogEntry(logEntry);
- }
- }
- }
-
- private void TryAddLogEntry(LogEntry logEntry)
- {
- try
- {
- _options.LogEntries.Add(logEntry);
- }
catch
{
- // Ignore exception (can happen during stress testing)
+ // Ignore
+ }
+ }
+ else
+ {
+ await Task.WhenAll(tasks.Select(async task => await task.Invoke())).ConfigureAwait(false);
+ }
+ }
+
+ private void UpdateScenarioState(IMapping mapping)
+ {
+ var scenario = _options.Scenarios[mapping.Scenario!];
+
+ // Increase the number of times this state has been executed
+ scenario.Counter++;
+
+ // Only if the number of times this state is executed equals the required StateTimes, proceed to next state and reset the counter to 0
+ if (scenario.Counter == (mapping.TimesInSameState ?? 1))
+ {
+ scenario.NextState = mapping.NextState;
+ scenario.Counter = 0;
+ }
+
+ // Else just update Started and Finished
+ scenario.Started = true;
+ scenario.Finished = mapping.NextState == null;
+ }
+
+ private void LogRequest(LogEntry entry, bool addRequest)
+ {
+ _options.Logger.DebugRequestResponse(_logEntryMapper.Map(entry), entry.RequestMessage.Path.StartsWith("/__admin/"));
+
+ // If addRequest is set to true and MaxRequestLogCount is null or does have a value greater than 0, try to add a new request log.
+ if (addRequest && _options.MaxRequestLogCount is null or > 0)
+ {
+ TryAddLogEntry(entry);
+ }
+
+ // In case MaxRequestLogCount has a value greater than 0, try to delete existing request logs based on the count.
+ if (_options.MaxRequestLogCount is > 0)
+ {
+ var logEntries = _options.LogEntries.ToList();
+ foreach (var logEntry in logEntries.OrderBy(le => le.RequestMessage.DateTime).Take(logEntries.Count - _options.MaxRequestLogCount.Value))
+ {
+ TryRemoveLogEntry(logEntry);
}
}
- private void TryRemoveLogEntry(LogEntry logEntry)
+ // In case RequestLogExpirationDuration has a value greater than 0, try to delete existing request logs based on the date.
+ if (_options.RequestLogExpirationDuration is > 0)
{
- try
+ var checkTime = DateTime.UtcNow.AddHours(-_options.RequestLogExpirationDuration.Value);
+ foreach (var logEntry in _options.LogEntries.ToList().Where(le => le.RequestMessage.DateTime < checkTime))
{
- _options.LogEntries.Remove(logEntry);
- }
- catch
- {
- // Ignore exception (can happen during stress testing)
+ TryRemoveLogEntry(logEntry);
}
}
}
-}
+
+ private void TryAddLogEntry(LogEntry logEntry)
+ {
+ try
+ {
+ _options.LogEntries.Add(logEntry);
+ }
+ catch
+ {
+ // Ignore exception (can happen during stress testing)
+ }
+ }
+
+ private void TryRemoveLogEntry(LogEntry logEntry)
+ {
+ try
+ {
+ _options.LogEntries.Remove(logEntry);
+ }
+ catch
+ {
+ // Ignore exception (can happen during stress testing)
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/WireMock.Net.Minimal/Owin/WireMockMiddlewareOptions.cs b/src/WireMock.Net.Minimal/Owin/WireMockMiddlewareOptions.cs
index 6f675459..bfbc97d2 100644
--- a/src/WireMock.Net.Minimal/Owin/WireMockMiddlewareOptions.cs
+++ b/src/WireMock.Net.Minimal/Owin/WireMockMiddlewareOptions.cs
@@ -8,13 +8,17 @@ using WireMock.Matchers;
using WireMock.Types;
using WireMock.Util;
using System.Security.Cryptography.X509Certificates;
-
-#if !USE_ASPNETCORE
-using Owin;
-#else
-using IAppBuilder = Microsoft.AspNetCore.Builder.IApplicationBuilder;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Server.Kestrel.Https;
using Microsoft.Extensions.DependencyInjection;
-#endif
+using ClientCertificateMode = Microsoft.AspNetCore.Server.Kestrel.Https.ClientCertificateMode;
+
+//#if !USE_ASPNETCORE
+//using Owin;
+//#else
+//using IAppBuilder = Microsoft.AspNetCore.Builder.IApplicationBuilder;
+//using Microsoft.Extensions.DependencyInjection;
+//#endif
namespace WireMock.Owin;
@@ -38,11 +42,11 @@ internal class WireMockMiddlewareOptions : IWireMockMiddlewareOptions
public int? MaxRequestLogCount { get; set; }
- public Action? PreWireMockMiddlewareInit { get; set; }
+ public Action? PreWireMockMiddlewareInit { get; set; }
- public Action? PostWireMockMiddlewareInit { get; set; }
+ public Action? PostWireMockMiddlewareInit { get; set; }
-#if USE_ASPNETCORE
+//#if USE_ASPNETCORE
public Action? AdditionalServiceRegistration { get; set; }
public CorsPolicyOptions? CorsPolicyOptions { get; set; }
@@ -51,7 +55,7 @@ internal class WireMockMiddlewareOptions : IWireMockMiddlewareOptions
///
public bool AcceptAnyClientCertificate { get; set; }
-#endif
+ //#endif
///
public IFileSystemHandler? FileSystemHandler { get; set; }
diff --git a/src/WireMock.Net.Minimal/RequestMessage.cs b/src/WireMock.Net.Minimal/RequestMessage.cs
index e7fd8a70..300ef7ff 100644
--- a/src/WireMock.Net.Minimal/RequestMessage.cs
+++ b/src/WireMock.Net.Minimal/RequestMessage.cs
@@ -6,9 +6,10 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
-#if USE_ASPNETCORE
using System.Security.Cryptography.X509Certificates;
-#endif
+//#if USE_ASPNETCORE
+//using System.Security.Cryptography.X509Certificates;
+//#endif
using Stef.Validation;
using WireMock.Models;
using WireMock.Owin;
@@ -82,11 +83,11 @@ public class RequestMessage : IRequestMessage
///
public byte[]? BodyAsBytes { get; }
-#if MIMEKIT
+//#if MIMEKIT
///
[Newtonsoft.Json.JsonIgnore] // Issue 1001
public Models.Mime.IMimeMessageData? BodyAsMimeMessage { get; }
-#endif
+//#endif
///
public string? DetectedBodyType { get; }
@@ -109,10 +110,10 @@ public class RequestMessage : IRequestMessage
///
public string Origin { get; }
-#if USE_ASPNETCORE
+//#if USE_ASPNETCORE
///
public X509Certificate2? ClientCertificate { get; }
-#endif
+//#endif
///
/// Used for Unit Testing
@@ -136,9 +137,9 @@ public class RequestMessage : IRequestMessage
IDictionary? headers = null,
IDictionary? cookies = null,
string httpVersion = "1.1"
-#if USE_ASPNETCORE
+//#if USE_ASPNETCORE
, X509Certificate2? clientCertificate = null
-#endif
+//#endif
)
{
Guard.NotNull(urlDetails);
@@ -178,9 +179,9 @@ public class RequestMessage : IRequestMessage
Query = QueryStringParser.Parse(RawQuery, options?.QueryParameterMultipleValueSupport);
QueryIgnoreCase = new Dictionary>(Query, StringComparer.OrdinalIgnoreCase);
-#if USE_ASPNETCORE
+//#if USE_ASPNETCORE
ClientCertificate = clientCertificate;
-#endif
+//#endif
#if MIMEKIT
try
@@ -206,7 +207,6 @@ public class RequestMessage : IRequestMessage
}
var query = !ignoreCase ? Query : new Dictionary>(Query, StringComparer.OrdinalIgnoreCase);
-
- return query.ContainsKey(key) ? query[key] : null;
+ return query.TryGetValue(key, out var value) ? value : null;
}
}
\ No newline at end of file
diff --git a/src/WireMock.Net.Minimal/Server/WireMockServer.Admin.cs b/src/WireMock.Net.Minimal/Server/WireMockServer.Admin.cs
index 5c248a26..073c6ac5 100644
--- a/src/WireMock.Net.Minimal/Server/WireMockServer.Admin.cs
+++ b/src/WireMock.Net.Minimal/Server/WireMockServer.Admin.cs
@@ -295,11 +295,11 @@ public partial class WireMockServer
WatchStaticMappings = _settings.WatchStaticMappings,
WatchStaticMappingsInSubdirectories = _settings.WatchStaticMappingsInSubdirectories,
-#if USE_ASPNETCORE
+//#if USE_ASPNETCORE
AcceptAnyClientCertificate = _settings.AcceptAnyClientCertificate,
ClientCertificateMode = _settings.ClientCertificateMode,
CorsPolicyOptions = _settings.CorsPolicyOptions?.ToString()
-#endif
+//#endif
};
model.ProxyAndRecordSettings = TinyMapperUtils.Instance.Map(_settings.ProxyAndRecordSettings);
@@ -333,12 +333,12 @@ public partial class WireMockServer
InitSettings(_settings);
-#if USE_ASPNETCORE
+//#if USE_ASPNETCORE
if (Enum.TryParse(settings.CorsPolicyOptions, true, out var corsPolicyOptions))
{
_settings.CorsPolicyOptions = corsPolicyOptions;
}
-#endif
+//#endif
WireMockMiddlewareOptionsHelper.InitFromSettings(_settings, _options, o =>
{
@@ -347,11 +347,11 @@ public partial class WireMockServer
o.RequestProcessingDelay = TimeSpan.FromMilliseconds(settings.GlobalProcessingDelay.Value);
}
-#if USE_ASPNETCORE
+//#if USE_ASPNETCORE
o.CorsPolicyOptions = corsPolicyOptions;
- o.ClientCertificateMode = _settings.ClientCertificateMode;
+ o.ClientCertificateMode = (Microsoft.AspNetCore.Server.Kestrel.Https.ClientCertificateMode) _settings.ClientCertificateMode;
o.AcceptAnyClientCertificate = _settings.AcceptAnyClientCertificate;
-#endif
+//#endif
});
return ResponseMessageBuilder.Create(200, "Settings updated");
@@ -900,6 +900,6 @@ public partial class WireMockServer
}
var singleResult = ((JObject)value).ToObject();
- return new[] { singleResult! };
+ return [singleResult!];
}
}
\ No newline at end of file
diff --git a/src/WireMock.Net.Minimal/Server/WireMockServer.cs b/src/WireMock.Net.Minimal/Server/WireMockServer.cs
index b7d46738..0d85158e 100644
--- a/src/WireMock.Net.Minimal/Server/WireMockServer.cs
+++ b/src/WireMock.Net.Minimal/Server/WireMockServer.cs
@@ -62,7 +62,7 @@ public partial class WireMockServer : IWireMockServer
///
[PublicAPI]
- public int Port => Ports?.FirstOrDefault() ?? default;
+ public int Port => Ports?.FirstOrDefault() ?? 0;
///
[PublicAPI]
@@ -411,16 +411,16 @@ public partial class WireMockServer : IWireMockServer
_dateTimeUtils
);
-#if USE_ASPNETCORE
+ //#if USE_ASPNETCORE
_options.AdditionalServiceRegistration = _settings.AdditionalServiceRegistration;
_options.CorsPolicyOptions = _settings.CorsPolicyOptions;
- _options.ClientCertificateMode = _settings.ClientCertificateMode;
+ _options.ClientCertificateMode = (Microsoft.AspNetCore.Server.Kestrel.Https.ClientCertificateMode)_settings.ClientCertificateMode;
_options.AcceptAnyClientCertificate = _settings.AcceptAnyClientCertificate;
_httpServer = new AspNetCoreSelfHost(_options, urlOptions);
-#else
- _httpServer = new OwinSelfHost(_options, urlOptions);
-#endif
+ //#else
+ // _httpServer = new OwinSelfHost(_options, urlOptions);
+ //#endif
var startTask = _httpServer.StartAsync();
using (var ctsStartTimeout = new CancellationTokenSource(settings.StartTimeout))
diff --git a/src/WireMock.Net.Minimal/Util/UrlUtils.cs b/src/WireMock.Net.Minimal/Util/UrlUtils.cs
index 6c5eefad..c9d73e77 100644
--- a/src/WireMock.Net.Minimal/Util/UrlUtils.cs
+++ b/src/WireMock.Net.Minimal/Util/UrlUtils.cs
@@ -1,13 +1,14 @@
// Copyright © WireMock.Net
using System;
+using Microsoft.AspNetCore.Http;
using WireMock.Models;
using Stef.Validation;
-#if !USE_ASPNETCORE
-using Microsoft.Owin;
-#else
-using Microsoft.AspNetCore.Http;
-#endif
+//#if !USE_ASPNETCORE
+//using Microsoft.Owin;
+//#else
+//using Microsoft.AspNetCore.Http;
+//#endif
namespace WireMock.Util;
diff --git a/src/WireMock.Net.Minimal/WireMock.Net.Minimal.csproj b/src/WireMock.Net.Minimal/WireMock.Net.Minimal.csproj
index 6d245c53..f36a4337 100644
--- a/src/WireMock.Net.Minimal/WireMock.Net.Minimal.csproj
+++ b/src/WireMock.Net.Minimal/WireMock.Net.Minimal.csproj
@@ -3,7 +3,8 @@
Minimal version from the lightweight Http Mocking Server for .NET
WireMock.Net.Minimal
Stef Heyenrath
- net451;net452;net46;net461;netstandard1.3;netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0
+
+ net48;net8.0
true
WireMock.Net.Minimal
WireMock.Net.Minimal
@@ -28,7 +29,7 @@
../WireMock.Net/WireMock.Net.ruleset
-
+
-
+
$(DefineConstants);TRAILINGHEADERS
@@ -57,34 +58,55 @@
-
-
+
+
+
+
+
-
+
-
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+ -->
-
+
-
+
+ -->
-
+
-
+
+ -->
-
+
-
+
@@ -147,9 +169,9 @@
-
+
\ No newline at end of file
diff --git a/src/WireMock.Net.OpenApiParser/Extensions/OpenApiSchemaExtensions.cs b/src/WireMock.Net.OpenApiParser/Extensions/OpenApiSchemaExtensions.cs
index 51da19f3..dc17200c 100644
--- a/src/WireMock.Net.OpenApiParser/Extensions/OpenApiSchemaExtensions.cs
+++ b/src/WireMock.Net.OpenApiParser/Extensions/OpenApiSchemaExtensions.cs
@@ -5,9 +5,7 @@ using System.Linq;
using System.Reflection;
using System.Text.Json;
using System.Text.Json.Nodes;
-using Microsoft.OpenApi.Interfaces;
-using Microsoft.OpenApi.Models;
-using Microsoft.OpenApi.Models.Interfaces;
+using Microsoft.OpenApi;
using WireMock.Net.OpenApiParser.Types;
namespace WireMock.Net.OpenApiParser.Extensions;
diff --git a/src/WireMock.Net.OpenApiParser/Mappers/OpenApiPathsMapper.cs b/src/WireMock.Net.OpenApiParser/Mappers/OpenApiPathsMapper.cs
index fae8b50e..a4b3e8a5 100644
--- a/src/WireMock.Net.OpenApiParser/Mappers/OpenApiPathsMapper.cs
+++ b/src/WireMock.Net.OpenApiParser/Mappers/OpenApiPathsMapper.cs
@@ -6,8 +6,7 @@ using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Nodes;
-using Microsoft.OpenApi.Models;
-using Microsoft.OpenApi.Models.Interfaces;
+using Microsoft.OpenApi;
using Newtonsoft.Json;
using Stef.Validation;
using WireMock.Admin.Mappings;
diff --git a/src/WireMock.Net.OpenApiParser/Settings/IWireMockOpenApiParserExampleValues.cs b/src/WireMock.Net.OpenApiParser/Settings/IWireMockOpenApiParserExampleValues.cs
index 5d335144..6c3b3953 100644
--- a/src/WireMock.Net.OpenApiParser/Settings/IWireMockOpenApiParserExampleValues.cs
+++ b/src/WireMock.Net.OpenApiParser/Settings/IWireMockOpenApiParserExampleValues.cs
@@ -1,7 +1,7 @@
// Copyright © WireMock.Net
using System;
-using Microsoft.OpenApi.Models.Interfaces;
+using Microsoft.OpenApi;
namespace WireMock.Net.OpenApiParser.Settings;
diff --git a/src/WireMock.Net.OpenApiParser/Settings/WireMockOpenApiParserDynamicExampleValues.cs b/src/WireMock.Net.OpenApiParser/Settings/WireMockOpenApiParserDynamicExampleValues.cs
index 194762c5..0f27bf31 100644
--- a/src/WireMock.Net.OpenApiParser/Settings/WireMockOpenApiParserDynamicExampleValues.cs
+++ b/src/WireMock.Net.OpenApiParser/Settings/WireMockOpenApiParserDynamicExampleValues.cs
@@ -1,7 +1,7 @@
// Copyright © WireMock.Net
using System;
-using Microsoft.OpenApi.Models.Interfaces;
+using Microsoft.OpenApi;
using RandomDataGenerator.FieldOptions;
using RandomDataGenerator.Randomizers;
diff --git a/src/WireMock.Net.OpenApiParser/Settings/WireMockOpenApiParserExampleValues.cs b/src/WireMock.Net.OpenApiParser/Settings/WireMockOpenApiParserExampleValues.cs
index 3b3c6fea..5acec53a 100644
--- a/src/WireMock.Net.OpenApiParser/Settings/WireMockOpenApiParserExampleValues.cs
+++ b/src/WireMock.Net.OpenApiParser/Settings/WireMockOpenApiParserExampleValues.cs
@@ -1,8 +1,7 @@
// Copyright © WireMock.Net
using System;
-using Microsoft.OpenApi.Models;
-using Microsoft.OpenApi.Models.Interfaces;
+using Microsoft.OpenApi;
namespace WireMock.Net.OpenApiParser.Settings;
diff --git a/src/WireMock.Net.OpenApiParser/Utils/ExampleValueGenerator.cs b/src/WireMock.Net.OpenApiParser/Utils/ExampleValueGenerator.cs
index 153d4c67..2560873f 100644
--- a/src/WireMock.Net.OpenApiParser/Utils/ExampleValueGenerator.cs
+++ b/src/WireMock.Net.OpenApiParser/Utils/ExampleValueGenerator.cs
@@ -3,8 +3,7 @@
using System;
using System.Linq;
using System.Text.Json.Nodes;
-using Microsoft.OpenApi.Models;
-using Microsoft.OpenApi.Models.Interfaces;
+using Microsoft.OpenApi;
using Stef.Validation;
using WireMock.Net.OpenApiParser.Extensions;
using WireMock.Net.OpenApiParser.Settings;
diff --git a/src/WireMock.Net.OpenApiParser/WireMock.Net.OpenApiParser.csproj b/src/WireMock.Net.OpenApiParser/WireMock.Net.OpenApiParser.csproj
index fb454756..8399fbd1 100644
--- a/src/WireMock.Net.OpenApiParser/WireMock.Net.OpenApiParser.csproj
+++ b/src/WireMock.Net.OpenApiParser/WireMock.Net.OpenApiParser.csproj
@@ -2,7 +2,8 @@
An OpenApi (swagger) parser to generate MappingModel or mapping.json file.
- netstandard2.0;net8.0
+
+ net48;net8.0
true
wiremock;openapi;OAS;raml;converter;parser;openapiparser
{E5B03EEF-822C-4295-952B-4479AD30082B}
@@ -23,18 +24,18 @@
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
-
+
+
+
+
-
+
diff --git a/src/WireMock.Net.OpenApiParser/WireMockOpenApiParser.cs b/src/WireMock.Net.OpenApiParser/WireMockOpenApiParser.cs
index c4f16dcd..3ef51247 100644
--- a/src/WireMock.Net.OpenApiParser/WireMockOpenApiParser.cs
+++ b/src/WireMock.Net.OpenApiParser/WireMockOpenApiParser.cs
@@ -5,7 +5,7 @@ using System.Collections.Generic;
using System.IO;
using System.Text;
using JetBrains.Annotations;
-using Microsoft.OpenApi.Models;
+using Microsoft.OpenApi;
using Microsoft.OpenApi.Reader;
using Microsoft.OpenApi.YamlReader;
using RamlToOpenApiConverter;
diff --git a/src/WireMock.Net.ProtoBuf/Util/ProtoDefinitionDataHelper.cs b/src/WireMock.Net.ProtoBuf/Util/ProtoDefinitionDataHelper.cs
index 1ba3c06f..01f827af 100644
--- a/src/WireMock.Net.ProtoBuf/Util/ProtoDefinitionDataHelper.cs
+++ b/src/WireMock.Net.ProtoBuf/Util/ProtoDefinitionDataHelper.cs
@@ -40,7 +40,7 @@ internal static class ProtoDefinitionDataHelper
// Build comment and get content from file.
var comment = $"// {protoRelativePath}";
-#if NETSTANDARD2_0 || NET462
+#if NETSTANDARD2_0 || NET462 || NET48
var content = File.ReadAllText(filePath);
#else
var content = await File.ReadAllTextAsync(filePath, cancellationToken);
diff --git a/src/WireMock.Net.ProtoBuf/WireMock.Net.ProtoBuf.csproj b/src/WireMock.Net.ProtoBuf/WireMock.Net.ProtoBuf.csproj
index 23fb98aa..47710e3d 100644
--- a/src/WireMock.Net.ProtoBuf/WireMock.Net.ProtoBuf.csproj
+++ b/src/WireMock.Net.ProtoBuf/WireMock.Net.ProtoBuf.csproj
@@ -4,7 +4,8 @@
ProtoBuf and gRPC support for WireMock.Net
WireMock.Net.ProtoBuf
Stef Heyenrath
- netstandard2.1;net462;net6.0;net8.0
+
+ net48;net8.0
true
wiremock;matchers;matcher;protobuf;grpc
WireMock
@@ -26,7 +27,7 @@
-
+
diff --git a/src/WireMock.Net.RestClient/IWireMockAdminApi.cs b/src/WireMock.Net.RestClient/IWireMockAdminApi.cs
index 6ac9c7a7..afb69bc6 100644
--- a/src/WireMock.Net.RestClient/IWireMockAdminApi.cs
+++ b/src/WireMock.Net.RestClient/IWireMockAdminApi.cs
@@ -328,7 +328,7 @@ public interface IWireMockAdminApi
/// The ProtoDefinition as text.
/// The optional cancellationToken.
[Post("protodefinitions/{id}")]
- Task AddProtoDefinitionAsync([Path] string id, [Body] string body, CancellationToken cancellationToken = default);
+ Task AddProtoDefinitionAsync([Path] string id, [Body] string protoDefinition, CancellationToken cancellationToken = default);
///
/// Check if a file exists
diff --git a/src/WireMock.Net.RestClient/WireMock.Net.RestClient.csproj b/src/WireMock.Net.RestClient/WireMock.Net.RestClient.csproj
index 3baecc43..e8175561 100644
--- a/src/WireMock.Net.RestClient/WireMock.Net.RestClient.csproj
+++ b/src/WireMock.Net.RestClient/WireMock.Net.RestClient.csproj
@@ -4,7 +4,8 @@
A RestClient using RestEase to access the admin interface.
WireMock.Net.RestClient
Stef Heyenrath
- net45;netstandard1.3;netstandard2.0;netstandard2.1
+
+ net48;net8.0
true
WireMock.Net.RestClient
WireMock.Net.RestClient
@@ -33,9 +34,9 @@
-
+
-
+
diff --git a/src/WireMock.Net.Shared/IMapping.cs b/src/WireMock.Net.Shared/IMapping.cs
index 8fba4ab0..764ed4d3 100644
--- a/src/WireMock.Net.Shared/IMapping.cs
+++ b/src/WireMock.Net.Shared/IMapping.cs
@@ -147,7 +147,7 @@ public interface IMapping
/// ProvideResponseAsync
///
/// The request message.
- /// The including a new (optional) .
+ /// The including a new (optional) .
Task<(IResponseMessage Message, IMapping? Mapping)> ProvideResponseAsync(IRequestMessage requestMessage);
///
diff --git a/src/WireMock.Net.Shared/Settings/WireMockServerSettings.cs b/src/WireMock.Net.Shared/Settings/WireMockServerSettings.cs
index 86f99f38..dbe357f8 100644
--- a/src/WireMock.Net.Shared/Settings/WireMockServerSettings.cs
+++ b/src/WireMock.Net.Shared/Settings/WireMockServerSettings.cs
@@ -14,10 +14,7 @@ using WireMock.RegularExpressions;
using WireMock.Types;
using System.Globalization;
using WireMock.Models;
-
-#if USE_ASPNETCORE
using Microsoft.Extensions.DependencyInjection;
-#endif
namespace WireMock.Settings;
@@ -151,7 +148,7 @@ public class WireMockServerSettings
[JsonIgnore]
public Action
[PublicAPI]
public CorsPolicyOptions? CorsPolicyOptions { get; set; }
-#endif
+//#endif
///
/// The IWireMockLogger which logs Debug, Info, Warning or Error
@@ -249,7 +246,7 @@ public class WireMockServerSettings
[PublicAPI]
public bool CustomCertificateDefined => CertificateSettings?.IsDefined == true;
-#if USE_ASPNETCORE
+//#if USE_ASPNETCORE
///
/// Client certificate mode for the server
///
@@ -260,7 +257,7 @@ public class WireMockServerSettings
/// Whether to accept any client certificate
///
public bool AcceptAnyClientCertificate { get; set; }
-#endif
+//#endif
///
/// Defines the global IWebhookSettings to use.
diff --git a/src/WireMock.Net.Shared/WireMock.Net.Shared.csproj b/src/WireMock.Net.Shared/WireMock.Net.Shared.csproj
index 2b01dd01..7bec17d2 100644
--- a/src/WireMock.Net.Shared/WireMock.Net.Shared.csproj
+++ b/src/WireMock.Net.Shared/WireMock.Net.Shared.csproj
@@ -2,7 +2,8 @@
Shared interfaces, models, enumerations and types.
Stef Heyenrath
- net451;net452;net46;net461;netstandard1.3;netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0
+
+ net48;net8.0
true
tdd;mock;http;wiremock;test;server;shared
WireMock
@@ -29,7 +30,7 @@
true
-
+
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
+
+
-
-
+
+
@@ -61,11 +62,12 @@
+
-
+
diff --git a/src/WireMock.Net.StandAlone/WireMock.Net.StandAlone.csproj b/src/WireMock.Net.StandAlone/WireMock.Net.StandAlone.csproj
index c1715a86..9ca17e37 100644
--- a/src/WireMock.Net.StandAlone/WireMock.Net.StandAlone.csproj
+++ b/src/WireMock.Net.StandAlone/WireMock.Net.StandAlone.csproj
@@ -1,9 +1,10 @@
-
+
Lightweight StandAlone Http Mocking Server for .Net.
WireMock.Net.StandAlone
Stef Heyenrath
- net451;net452;net46;net461;netstandard1.3;netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0
+
+ net48;net8.0
true
WireMock.Net.StandAlone
WireMock.Net.StandAlone
@@ -27,19 +28,26 @@
true
-
+
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
\ No newline at end of file
diff --git a/src/WireMock.Net.TUnit/WireMock.Net.TUnit.csproj b/src/WireMock.Net.TUnit/WireMock.Net.TUnit.csproj
index 71d6bedb..73e9be9e 100644
--- a/src/WireMock.Net.TUnit/WireMock.Net.TUnit.csproj
+++ b/src/WireMock.Net.TUnit/WireMock.Net.TUnit.csproj
@@ -27,8 +27,8 @@
-
-
+
+
diff --git a/src/WireMock.Net.Testcontainers/WireMock.Net.Testcontainers.csproj b/src/WireMock.Net.Testcontainers/WireMock.Net.Testcontainers.csproj
index 565bdbbc..2f95a43d 100644
--- a/src/WireMock.Net.Testcontainers/WireMock.Net.Testcontainers.csproj
+++ b/src/WireMock.Net.Testcontainers/WireMock.Net.Testcontainers.csproj
@@ -38,7 +38,7 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/src/WireMock.Net.xUnit/WireMock.Net.xUnit.csproj b/src/WireMock.Net.xUnit/WireMock.Net.xUnit.csproj
index 48496be1..33a212ab 100644
--- a/src/WireMock.Net.xUnit/WireMock.Net.xUnit.csproj
+++ b/src/WireMock.Net.xUnit/WireMock.Net.xUnit.csproj
@@ -3,7 +3,8 @@
Some extensions for xUnit (ITestOutputHelper)
WireMock.Net.xUnit
Stef Heyenrath
- net45;net451;netstandard1.3;netstandard2.0;netstandard2.1
+
+ net48;net8.0
true
WireMock.Net.xUnit
WireMock.Net.Xunit
diff --git a/src/WireMock.Net/WireMock.Net.csproj b/src/WireMock.Net/WireMock.Net.csproj
index f07348a0..a48026a6 100644
--- a/src/WireMock.Net/WireMock.Net.csproj
+++ b/src/WireMock.Net/WireMock.Net.csproj
@@ -3,7 +3,8 @@
Lightweight Http Mocking Server for .NET, inspired by WireMock from the Java landscape.
WireMock.Net
Stef Heyenrath
- net451;net452;net46;net461;netstandard1.3;netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0
+
+ net48;net8.0
true
WireMock.Net
WireMock.Net
@@ -28,13 +29,22 @@
WireMock.Net.ruleset
+
+ $(DefineConstants);GRAPHQL;MIMEKIT;PROTOBUF
+
+
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/src/WireMock.Org.Abstractions/WireMock.Org.Abstractions.csproj b/src/WireMock.Org.Abstractions/WireMock.Org.Abstractions.csproj
index bd776b0b..9cc41ba6 100644
--- a/src/WireMock.Org.Abstractions/WireMock.Org.Abstractions.csproj
+++ b/src/WireMock.Org.Abstractions/WireMock.Org.Abstractions.csproj
@@ -4,7 +4,8 @@
Commonly used interfaces, models, enumerations and types.
WireMock.Org.Abstractions
Stef Heyenrath
- net45;netstandard1.0;netstandard2.0;netstandard2.1
+
+ net48;net8.0
true
$(NoWarn);1591;8603
WireMock.Org.Abstractions
diff --git a/src/WireMock.Org.RestClient/WireMock.Org.RestClient.csproj b/src/WireMock.Org.RestClient/WireMock.Org.RestClient.csproj
index 34a7796e..31dc8eef 100644
--- a/src/WireMock.Org.RestClient/WireMock.Org.RestClient.csproj
+++ b/src/WireMock.Org.RestClient/WireMock.Org.RestClient.csproj
@@ -4,7 +4,8 @@
A WireMock.org RestClient using RestEase to access the admin interface.
WireMock.Org.RestClient
Stef Heyenrath
- net45;netstandard1.1;netstandard2.0;netstandard2.1
+
+ net48;net8.0
true
WireMock.Org.RestClient
WireMock.Org.RestClient
diff --git a/test/Directory.Build.props b/test/Directory.Build.props
index c6070279..e42f8a67 100644
--- a/test/Directory.Build.props
+++ b/test/Directory.Build.props
@@ -1,7 +1,7 @@
-
+
diff --git a/test/WireMock.Net.Extensions.Routing.Tests/WireMock.Net.Extensions.Routing.Tests.csproj b/test/WireMock.Net.Extensions.Routing.Tests/WireMock.Net.Extensions.Routing.Tests.csproj
index cd5de199..0f9d0c22 100644
--- a/test/WireMock.Net.Extensions.Routing.Tests/WireMock.Net.Extensions.Routing.Tests.csproj
+++ b/test/WireMock.Net.Extensions.Routing.Tests/WireMock.Net.Extensions.Routing.Tests.csproj
@@ -21,7 +21,7 @@
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/test/WireMock.Net.TUnitTests/WireMock.Net.TUnitTests.csproj b/test/WireMock.Net.TUnitTests/WireMock.Net.TUnitTests.csproj
index ac4bf011..7f4c621d 100644
--- a/test/WireMock.Net.TUnitTests/WireMock.Net.TUnitTests.csproj
+++ b/test/WireMock.Net.TUnitTests/WireMock.Net.TUnitTests.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/test/WireMock.Net.Tests/AdminApi/WireMockAdminApiTests.IWireMockAdminApi_GetMappingsCode.verified.txt b/test/WireMock.Net.Tests/AdminApi/WireMockAdminApiTests.IWireMockAdminApi_GetMappingsCode.verified.txt
index 764576f7..8179e181 100644
--- a/test/WireMock.Net.Tests/AdminApi/WireMockAdminApiTests.IWireMockAdminApi_GetMappingsCode.verified.txt
+++ b/test/WireMock.Net.Tests/AdminApi/WireMockAdminApiTests.IWireMockAdminApi_GetMappingsCode.verified.txt
@@ -59,7 +59,7 @@ server
)
.WithGuid("c9929240-7ae8-4a5d-8ed8-0913479f6eeb")
.RespondWith(Response.Create()
- .WithStatusCode(208)
+ .WithStatusCode(306)
.WithBodyAsJson(new
{
@as = 1,
diff --git a/test/WireMock.Net.Tests/AdminApi/WireMockAdminApiTests.cs b/test/WireMock.Net.Tests/AdminApi/WireMockAdminApiTests.cs
index 20aaea0b..975116da 100644
--- a/test/WireMock.Net.Tests/AdminApi/WireMockAdminApiTests.cs
+++ b/test/WireMock.Net.Tests/AdminApi/WireMockAdminApiTests.cs
@@ -1,6 +1,6 @@
// Copyright © WireMock.Net
-#if !(NET452 || NET461 || NETCOREAPP3_1)
+//#if !(NET452 || NET461 || NETCOREAPP3_1)
using System;
using System.Collections.Generic;
using System.IO;
@@ -69,10 +69,10 @@ public partial class WireMockAdminApiTests
.WithAuthorization(adminUsername, adminPassword);
// Act 1
- await api.WaitForHealthAsync().ConfigureAwait(false);
+ await api.WaitForHealthAsync();
// Act 2
- var status = await api.GetHealthAsync().ConfigureAwait(false);
+ var status = await api.GetHealthAsync();
status.Should().Be("Healthy");
}
@@ -102,7 +102,7 @@ public partial class WireMockAdminApiTests
var api = RestClient.For(server.Urls[0]);
// Act
- var settings = await api.GetSettingsAsync().ConfigureAwait(false);
+ var settings = await api.GetSettingsAsync();
Check.That(settings).IsNotNull();
}
@@ -118,7 +118,7 @@ public partial class WireMockAdminApiTests
var api = RestClient.For(server.Urls[0] + "/foo");
// Act
- var settings = await api.GetSettingsAsync().ConfigureAwait(false);
+ var settings = await api.GetSettingsAsync();
// Assert
Check.That(settings).IsNotNull();
@@ -137,7 +137,7 @@ public partial class WireMockAdminApiTests
// Act
var settings = new SettingsModel();
- var status = await api.PostSettingsAsync(settings).ConfigureAwait(false);
+ var status = await api.PostSettingsAsync(settings);
Check.That(status.Status).Equals("Settings updated");
}
@@ -150,7 +150,7 @@ public partial class WireMockAdminApiTests
// Act
var settings = new SettingsModel();
- var status = await api.PutSettingsAsync(settings).ConfigureAwait(false);
+ var status = await api.PutSettingsAsync(settings);
Check.That(status.Status).Equals("Settings updated");
}
@@ -170,7 +170,7 @@ public partial class WireMockAdminApiTests
Priority = 500,
Title = "test"
};
- var result = await api.PutMappingAsync(new Guid("a0000000-0000-0000-0000-000000000000"), model).ConfigureAwait(false);
+ var result = await api.PutMappingAsync(new Guid("a0000000-0000-0000-0000-000000000000"), model);
// Assert
Check.That(result).IsNotNull();
@@ -200,11 +200,11 @@ public partial class WireMockAdminApiTests
.RespondWith(Response.Create());
var serverUrl = "http://localhost:" + server.Ports[0];
- await new HttpClient().GetAsync(serverUrl + "/foo").ConfigureAwait(false);
+ await new HttpClient().GetAsync(serverUrl + "/foo");
var api = RestClient.For(serverUrl);
// Act
- var requests = await api.FindRequestsAsync(new RequestModel { Methods = new[] { "GET" } }).ConfigureAwait(false);
+ var requests = await api.FindRequestsAsync(new RequestModel { Methods = new[] { "GET" } });
// Assert
requests.Should().HaveCount(1);
@@ -231,12 +231,12 @@ public partial class WireMockAdminApiTests
var serverUrl = "http://localhost:" + server.Ports[0];
using var client = new HttpClient();
- await client.GetAsync(serverUrl + "/foo").ConfigureAwait(false);
- await client.GetAsync(serverUrl + "/foo?bar=baz").ConfigureAwait(false);
+ await client.GetAsync(serverUrl + "/foo");
+ await client.GetAsync(serverUrl + "/foo?bar=baz");
var api = RestClient.For(serverUrl);
// Act
- var logEntryModels = await api.FindRequestsByMappingGuidAsync(mappingGuid).ConfigureAwait(false);
+ var logEntryModels = await api.FindRequestsByMappingGuidAsync(mappingGuid);
// Assert
logEntryModels.Should().HaveCount(2);
@@ -270,11 +270,11 @@ public partial class WireMockAdminApiTests
.RespondWith(Response.Create());
var serverUrl = "http://localhost:" + server.Ports[0];
- await new HttpClient().GetAsync(serverUrl + "/foo").ConfigureAwait(false);
+ await new HttpClient().GetAsync(serverUrl + "/foo");
var api = RestClient.For(serverUrl);
// Act
- var logEntryModels = await api.FindRequestsByMappingGuidAsync(Guid.NewGuid()).ConfigureAwait(false);
+ var logEntryModels = await api.FindRequestsByMappingGuidAsync(Guid.NewGuid());
// Assert
logEntryModels.Should().BeEmpty();
@@ -307,11 +307,11 @@ public partial class WireMockAdminApiTests
Logger = new WireMockNullLogger()
});
var serverUrl = "http://localhost:" + server.Ports[0];
- await new HttpClient().GetAsync(serverUrl + "/foo").ConfigureAwait(false);
+ await new HttpClient().GetAsync(serverUrl + "/foo");
var api = RestClient.For(serverUrl);
// Act
- var requests = await api.GetRequestsAsync().ConfigureAwait(false);
+ var requests = await api.GetRequestsAsync();
// Assert
Check.That(requests).HasSize(1);
@@ -347,7 +347,7 @@ public partial class WireMockAdminApiTests
var api = RestClient.For(serverUrl);
// Act
- var requests = await api.GetRequestsAsync().ConfigureAwait(false);
+ var requests = await api.GetRequestsAsync();
// Assert
Check.That(requests).HasSize(1);
@@ -384,7 +384,7 @@ public partial class WireMockAdminApiTests
},
Response = new ResponseModel { Body = "world" }
};
- var postMappingResult = await api.PostMappingAsync(model).ConfigureAwait(false);
+ var postMappingResult = await api.PostMappingAsync(model);
// Assert
postMappingResult.Should().NotBeNull();
@@ -392,7 +392,7 @@ public partial class WireMockAdminApiTests
var mapping = server.Mappings.FirstOrDefault(m => m.Guid == guid);
mapping.Should().NotBeNull();
- var getMappingResult = await api.GetMappingAsync(guid).ConfigureAwait(false);
+ var getMappingResult = await api.GetMappingAsync(guid);
await Verifier.Verify(getMappingResult, VerifySettings).DontScrubGuids();
@@ -435,7 +435,7 @@ public partial class WireMockAdminApiTests
}
}
};
- var postMappingResult = await api.PostMappingAsync(model).ConfigureAwait(false);
+ var postMappingResult = await api.PostMappingAsync(model);
// Assert
postMappingResult.Should().NotBeNull();
@@ -443,7 +443,7 @@ public partial class WireMockAdminApiTests
var mapping = server.Mappings.FirstOrDefault(m => m.Guid == guid);
mapping.Should().NotBeNull();
- var getMappingResult = await api.GetMappingAsync(guid).ConfigureAwait(false);
+ var getMappingResult = await api.GetMappingAsync(guid);
await Verifier.Verify(getMappingResult, VerifySettings).DontScrubGuids();
@@ -475,7 +475,7 @@ public partial class WireMockAdminApiTests
var api = RestClient.For(serverUrl);
// Act
- var requests = await api.GetRequestsAsync().ConfigureAwait(false);
+ var requests = await api.GetRequestsAsync();
// Assert
Check.That(requests).HasSize(1);
@@ -504,7 +504,7 @@ public partial class WireMockAdminApiTests
var api = RestClient.For(server.Urls[0]);
// Act
- var request = await api.PostFileAsync("filename.txt", "abc").ConfigureAwait(false);
+ var request = await api.PostFileAsync("filename.txt", "abc");
// Assert
Check.That(request.Guid).IsNull();
@@ -537,7 +537,7 @@ public partial class WireMockAdminApiTests
var api = RestClient.For(server.Urls[0]);
// Act
- var request = await api.PutFileAsync("filename.txt", "abc-abc").ConfigureAwait(false);
+ var request = await api.PutFileAsync("filename.txt", "abc-abc");
// Assert
Check.That(request.Guid).IsNull();
@@ -568,7 +568,7 @@ public partial class WireMockAdminApiTests
var api = RestClient.For(server.Urls[0]);
// Act and Assert
- Check.ThatAsyncCode(() => api.PutFileAsync("filename.txt", "xxx")).Throws();
+ Check.ThatCode(() => api.PutFileAsync("filename.txt", "xxx")).Throws();
// Verify
filesystemHandlerMock.Verify(fs => fs.FileExists(It.Is(p => p == "filename.txt")), Times.Once);
@@ -595,7 +595,7 @@ public partial class WireMockAdminApiTests
var api = RestClient.For(server.Urls[0]);
// Act and Assert
- Check.ThatAsyncCode(() => api.GetFileAsync("filename.txt")).Throws();
+ Check.ThatCode(() => api.GetFileAsync("filename.txt")).Throws();
// Verify
filesystemHandlerMock.Verify(fs => fs.FileExists(It.Is(p => p == "filename.txt")), Times.Once);
@@ -623,7 +623,7 @@ public partial class WireMockAdminApiTests
var api = RestClient.For(server.Urls[0]);
// Act
- string file = await api.GetFileAsync("filename.txt").ConfigureAwait(false);
+ string file = await api.GetFileAsync("filename.txt");
// Assert
Check.That(file).Equals(data);
@@ -654,7 +654,7 @@ public partial class WireMockAdminApiTests
var api = RestClient.For(server.Urls[0]);
// Act
- await api.DeleteFileAsync("filename.txt").ConfigureAwait(false);
+ await api.DeleteFileAsync("filename.txt");
// Verify
filesystemHandlerMock.Verify(fs => fs.FileExists(It.Is(p => p == "filename.txt")), Times.Once);
@@ -682,7 +682,7 @@ public partial class WireMockAdminApiTests
var api = RestClient.For(server.Urls[0]);
// Act and Assert
- Check.ThatAsyncCode(() => api.DeleteFileAsync("filename.txt")).Throws();
+ Check.ThatCode(() => api.DeleteFileAsync("filename.txt")).Throws();
// Verify
filesystemHandlerMock.Verify(fs => fs.FileExists(It.Is(p => p == "filename.txt")), Times.Once);
@@ -708,7 +708,7 @@ public partial class WireMockAdminApiTests
var api = RestClient.For(server.Urls[0]);
// Act and Assert
- Check.ThatAsyncCode(() => api.FileExistsAsync("filename.txt")).Throws();
+ Check.ThatCode(() => api.FileExistsAsync("filename.txt")).Throws();
// Verify
filesystemHandlerMock.Verify(fs => fs.FileExists(It.Is(p => p == "filename.txt")), Times.Once);
@@ -726,7 +726,7 @@ public partial class WireMockAdminApiTests
var api = RestClient.For(server.Urls[0]);
// Act
- var status = await api.DeleteScenarioAsync(name).ConfigureAwait(false);
+ var status = await api.DeleteScenarioAsync(name);
status.Status.Should().Be("No scenario found by name 'x'.");
}
@@ -739,7 +739,7 @@ public partial class WireMockAdminApiTests
var api = RestClient.For(server.Urls[0]);
// Act
- var status = await api.ResetScenarioAsync(name).ConfigureAwait(false);
+ var status = await api.ResetScenarioAsync(name);
status.Status.Should().Be("No scenario found by name 'x'.");
}
@@ -756,7 +756,7 @@ public partial class WireMockAdminApiTests
{
State = null
};
- var status = await api.PutScenarioStateAsync("x", update).ConfigureAwait(false);
+ var status = await api.PutScenarioStateAsync("x", update);
status.Status.Should().Be("No scenario found by name 'x'.");
}
@@ -790,7 +790,7 @@ public partial class WireMockAdminApiTests
{
State = null
};
- var status = await api.PutScenarioStateAsync("s1", update).ConfigureAwait(false);
+ var status = await api.PutScenarioStateAsync("s1", update);
status.Status.Should().Be("Scenario state set to ''");
}
@@ -817,7 +817,7 @@ public partial class WireMockAdminApiTests
// Act
var api = RestClient.For(server.Url);
- var getMappingResult = await api.GetMappingAsync(guid).ConfigureAwait(false);
+ var getMappingResult = await api.GetMappingAsync(guid);
// Assert
var mapping = server.Mappings.FirstOrDefault(m => m.Guid == guid);
@@ -852,10 +852,10 @@ public partial class WireMockAdminApiTests
// Act
var api = RestClient.For(server.Url);
- var mappings = await api.GetMappingsAsync().ConfigureAwait(false);
+ var mappings = await api.GetMappingsAsync();
mappings.Should().HaveCount(1);
- var code = await api.GetMappingCodeAsync(guid).ConfigureAwait(false);
+ var code = await api.GetMappingCodeAsync(guid);
// Assert
await Verifier.Verify(code).DontScrubDateTimes().DontScrubGuids();
@@ -942,7 +942,7 @@ public partial class WireMockAdminApiTests
.WithGuid(guid5)
.RespondWith(
Response.Create()
- .WithStatusCode(HttpStatusCode.AlreadyReported)
+ .WithStatusCode(HttpStatusCode.Unused)
.WithBodyAsJson(new
{
@as = 1,
@@ -974,10 +974,10 @@ text
// Act
var api = RestClient.For(server.Url);
- var mappings = await api.GetMappingsAsync().ConfigureAwait(false);
+ var mappings = await api.GetMappingsAsync();
mappings.Should().HaveCount(5);
- var code = await api.GetMappingsCodeAsync().ConfigureAwait(false);
+ var code = await api.GetMappingsCodeAsync();
// Assert
await Verifier.Verify(code).DontScrubDateTimes().DontScrubGuids();
@@ -989,13 +989,13 @@ text
public async Task IWireMockAdminApi_OpenApiConvert_Yml()
{
// Arrange
- var openApiDocument = await File.ReadAllTextAsync(Path.Combine("OpenApiParser", "petstore.yml"));
+ var openApiDocument = File.ReadAllText(Path.Combine("OpenApiParser", "petstore.yml"));
var server = WireMockServer.StartWithAdminInterface();
var api = RestClient.For(server.Url);
// Act
- var mappings = await api.OpenApiConvertAsync(openApiDocument).ConfigureAwait(false);
+ var mappings = await api.OpenApiConvertAsync(openApiDocument);
// Assert
server.MappingModels.Should().BeEmpty();
@@ -1008,13 +1008,13 @@ text
public async Task IWireMockAdminApi_OpenApiConvert_Json()
{
// Arrange
- var openApiDocument = await File.ReadAllTextAsync(Path.Combine("OpenApiParser", "petstore-openapi3.json"));
+ var openApiDocument = File.ReadAllText(Path.Combine("OpenApiParser", "petstore-openapi3.json"));
var server = WireMockServer.StartWithAdminInterface();
var api = RestClient.For(server.Url);
// Act
- var mappings = await api.OpenApiConvertAsync(openApiDocument).ConfigureAwait(false);
+ var mappings = await api.OpenApiConvertAsync(openApiDocument);
// Assert
server.MappingModels.Should().BeEmpty();
@@ -1027,13 +1027,13 @@ text
public async Task IWireMockAdminApi_OpenApiSave_Json()
{
// Arrange
- var openApiDocument = await File.ReadAllTextAsync(Path.Combine("OpenApiParser", "petstore-openapi3.json"));
+ var openApiDocument = File.ReadAllText(Path.Combine("OpenApiParser", "petstore-openapi3.json"));
var server = WireMockServer.StartWithAdminInterface();
var api = RestClient.For(server.Url);
// Act
- var statusModel = await api.OpenApiSaveAsync(openApiDocument).ConfigureAwait(false);
+ var statusModel = await api.OpenApiSaveAsync(openApiDocument);
// Assert
statusModel.Status.Should().Be("OpenApi document converted to Mappings");
@@ -1046,13 +1046,13 @@ text
public async Task IWireMockAdminApi_OpenApiSave_Yml()
{
// Arrange
- var openApiDocument = await File.ReadAllTextAsync(Path.Combine("OpenApiParser", "petstore.yml"));
+ var openApiDocument = File.ReadAllText(Path.Combine("OpenApiParser", "petstore.yml"));
var server = WireMockServer.StartWithAdminInterface();
var api = RestClient.For(server.Url);
// Act
- var mappings = await api.OpenApiConvertAsync(openApiDocument).ConfigureAwait(false);
+ var mappings = await api.OpenApiConvertAsync(openApiDocument);
// Assert
server.MappingModels.Should().BeEmpty();
@@ -1069,7 +1069,7 @@ text
var api = RestClient.For(server.Url);
// Act
- var status = await api.ReloadStaticMappingsAsync().ConfigureAwait(false);
+ var status = await api.ReloadStaticMappingsAsync();
// Assert
status.Status.Should().Be("Static Mappings reloaded");
@@ -1080,4 +1080,4 @@ text
return File.ReadAllText(Path.Combine(Directory.GetCurrentDirectory(), "__admin", "mappings", filename));
}
}
-#endif
\ No newline at end of file
+//#endif
\ No newline at end of file
diff --git a/test/WireMock.Net.Tests/FluentAssertions/WireMockAssertionsTests.cs b/test/WireMock.Net.Tests/FluentAssertions/WireMockAssertionsTests.cs
index 6b152f08..b2288e9b 100644
--- a/test/WireMock.Net.Tests/FluentAssertions/WireMockAssertionsTests.cs
+++ b/test/WireMock.Net.Tests/FluentAssertions/WireMockAssertionsTests.cs
@@ -5,6 +5,7 @@ using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
+using System.Net.Http.Json;
using System.Threading.Tasks;
using FluentAssertions;
using WireMock.FluentAssertions;
diff --git a/test/WireMock.Net.Tests/Grpc/ProtoBufUtilsTests.cs b/test/WireMock.Net.Tests/Grpc/ProtoBufUtilsTests.cs
index aa1df07d..06c4d2ea 100644
--- a/test/WireMock.Net.Tests/Grpc/ProtoBufUtilsTests.cs
+++ b/test/WireMock.Net.Tests/Grpc/ProtoBufUtilsTests.cs
@@ -1,6 +1,6 @@
// Copyright © WireMock.Net
-#if PROTOBUF
+//#if PROTOBUF
using System;
using System.IO;
using System.Threading.Tasks;
@@ -18,8 +18,8 @@ public class ProtoBufUtilsTests
public async Task GetProtoBufMessageWithHeader_MultipleProtoFiles()
{
// Arrange
- var greet = await ReadProtoFileAsync("greet1.proto");
- var request = await ReadProtoFileAsync("request.proto");
+ var greet = ReadProtoFile("greet1.proto");
+ var request = ReadProtoFile("request.proto");
// Act
var responseBytes = await ProtoBufUtils.GetProtoBufMessageWithHeaderAsync(
@@ -35,9 +35,9 @@ public class ProtoBufUtilsTests
Convert.ToBase64String(responseBytes).Should().Be("AAAAAAcKBWhlbGxv");
}
- private static Task ReadProtoFileAsync(string filename)
+ private string ReadProtoFile(string filename)
{
- return File.ReadAllTextAsync(Path.Combine(Directory.GetCurrentDirectory(), "Grpc", filename));
+ return File.ReadAllText(Path.Combine(Directory.GetCurrentDirectory(), "Grpc", filename));
}
}
-#endif
\ No newline at end of file
+//#endif
\ No newline at end of file
diff --git a/test/WireMock.Net.Tests/Grpc/ProtoDefinitionHelperTests.cs b/test/WireMock.Net.Tests/Grpc/ProtoDefinitionHelperTests.cs
index c9c4c29d..ea3d1d4f 100644
--- a/test/WireMock.Net.Tests/Grpc/ProtoDefinitionHelperTests.cs
+++ b/test/WireMock.Net.Tests/Grpc/ProtoDefinitionHelperTests.cs
@@ -1,6 +1,6 @@
// Copyright © WireMock.Net
-#if PROTOBUF
+//#if PROTOBUF
using System;
using System.IO;
using System.Threading.Tasks;
@@ -72,4 +72,4 @@ public class ProtoDefinitionHelperTests
Convert.ToBase64String(responseBytes).Should().Be("AAAAAAcIARIDYWJj");
}
}
-#endif
\ No newline at end of file
+//#endif
\ No newline at end of file
diff --git a/test/WireMock.Net.Tests/Grpc/WireMockServerTests.Grpc.cs b/test/WireMock.Net.Tests/Grpc/WireMockServerTests.Grpc.cs
index 807acd85..c876df0d 100644
--- a/test/WireMock.Net.Tests/Grpc/WireMockServerTests.Grpc.cs
+++ b/test/WireMock.Net.Tests/Grpc/WireMockServerTests.Grpc.cs
@@ -1,6 +1,6 @@
// Copyright © WireMock.Net
-#if PROTOBUF
+//#if PROTOBUF
using System;
using System.IO;
using System.Net;
@@ -501,7 +501,7 @@ message Other {
public async Task WireMockServer_WithBodyAsProtoBuf_WithWellKnownTypes_Empty_UsingGrpcGeneratedClient()
{
// Arrange
- var definition = await File.ReadAllTextAsync("./Grpc/greet.proto");
+ var definition = File.ReadAllText("./Grpc/greet.proto");
using var server = WireMockServer.Start(useHttp2: true);
@@ -534,7 +534,7 @@ message Other {
// Arrange
const int seconds = 1722301323;
const int nanos = 12300;
- var definition = await File.ReadAllTextAsync("./Grpc/greet.proto");
+ var definition = File.ReadAllText("./Grpc/greet.proto");
using var server = WireMockServer.Start(useHttp2: true);
@@ -575,7 +575,7 @@ message Other {
// Arrange
const int seconds = 1722301323;
const int nanos = 12300;
- var definition = await File.ReadAllTextAsync("./Grpc/greet.proto");
+ var definition = File.ReadAllText("./Grpc/greet.proto");
using var server = WireMockServer.Start(useHttp2: true);
@@ -614,7 +614,7 @@ message Other {
public async Task WireMockServer_WithBodyAsProtoBuf_Enum_UsingGrpcGeneratedClient()
{
// Arrange
- var definition = await File.ReadAllTextAsync("./Grpc/greet.proto");
+ var definition = File.ReadAllText("./Grpc/greet.proto");
using var server = WireMockServer.Start(useHttp2: true);
@@ -655,7 +655,7 @@ message Other {
const int nanos = 12300;
const string version = "test";
const string correlationId = "correlation";
- var definition = await File.ReadAllTextAsync("./Grpc/policy.proto");
+ var definition = File.ReadAllText("./Grpc/policy.proto");
using var server = WireMockServer.Start(useHttp2: true);
@@ -773,4 +773,4 @@ message Other {
return File.ReadAllText(Path.Combine(Directory.GetCurrentDirectory(), "Grpc", filename));
}
}
-#endif
\ No newline at end of file
+//#endif
\ No newline at end of file
diff --git a/test/WireMock.Net.Tests/Matchers/MimePartMatcherTests.cs b/test/WireMock.Net.Tests/Matchers/MimePartMatcherTests.cs
index c6b6596b..493861d8 100644
--- a/test/WireMock.Net.Tests/Matchers/MimePartMatcherTests.cs
+++ b/test/WireMock.Net.Tests/Matchers/MimePartMatcherTests.cs
@@ -1,6 +1,6 @@
// Copyright © WireMock.Net
-#if MIMEKIT
+//#if MIMEKIT
using System;
using FluentAssertions;
using WireMock.Matchers;
@@ -100,4 +100,4 @@ public class MimePartMatcherTests
result.Score.Should().Be(MatchScores.Perfect);
}
}
-#endif
\ No newline at end of file
+//#endif
\ No newline at end of file
diff --git a/test/WireMock.Net.Tests/Matchers/Models/WireMockCustomScalarGraphTypeTests.cs b/test/WireMock.Net.Tests/Matchers/Models/WireMockCustomScalarGraphTypeTests.cs
index b557cd84..439bdc2d 100644
--- a/test/WireMock.Net.Tests/Matchers/Models/WireMockCustomScalarGraphTypeTests.cs
+++ b/test/WireMock.Net.Tests/Matchers/Models/WireMockCustomScalarGraphTypeTests.cs
@@ -1,6 +1,6 @@
// Copyright © WireMock.Net
-#if GRAPHQL
+//#if GRAPHQL
using System;
using FluentAssertions;
using WireMock.GraphQL.Models;
@@ -95,4 +95,4 @@ public class WireMockCustomScalarGraphTypeTests
result.Should().Be("someString");
}
}
-#endif
\ No newline at end of file
+//#endif
\ No newline at end of file
diff --git a/test/WireMock.Net.Tests/OpenApiParser/WireMockOpenApiParserTests.cs b/test/WireMock.Net.Tests/OpenApiParser/WireMockOpenApiParserTests.cs
index 8a291897..497d79a8 100644
--- a/test/WireMock.Net.Tests/OpenApiParser/WireMockOpenApiParserTests.cs
+++ b/test/WireMock.Net.Tests/OpenApiParser/WireMockOpenApiParserTests.cs
@@ -1,4 +1,4 @@
-#if !(NET452 || NET461 || NETCOREAPP3_1)
+//#if !(NET452 || NET461 || NETCOREAPP3_1)
using System;
using System.IO;
using System.Threading.Tasks;
@@ -40,7 +40,7 @@ public class WireMockOpenApiParserTests
ExampleValues = _exampleValuesMock.Object
};
- var openApiDocument = await File.ReadAllTextAsync(Path.Combine("OpenApiParser", "payroc-openapi-spec.yaml"));
+ var openApiDocument = File.ReadAllText(Path.Combine("OpenApiParser", "payroc-openapi-spec.yaml"));
// Act
var mappings = _sut.FromText(openApiDocument, settings, out _);
@@ -58,7 +58,7 @@ public class WireMockOpenApiParserTests
ExampleValues = _exampleValuesMock.Object
};
- var openApiDocument = await File.ReadAllTextAsync(Path.Combine("OpenApiParser", "oas-content-example.json"));
+ var openApiDocument = File.ReadAllText(Path.Combine("OpenApiParser", "oas-content-example.json"));
// Act
var mappings = _sut.FromText(openApiDocument, settings, out _);
@@ -67,4 +67,4 @@ public class WireMockOpenApiParserTests
await Verifier.Verify(mappings);
}
}
-#endif
\ No newline at end of file
+//#endif
\ No newline at end of file
diff --git a/test/WireMock.Net.Tests/Owin/GlobalExceptionMiddlewareTests.cs b/test/WireMock.Net.Tests/Owin/GlobalExceptionMiddlewareTests.cs
index b22e74f7..e9d28d37 100644
--- a/test/WireMock.Net.Tests/Owin/GlobalExceptionMiddlewareTests.cs
+++ b/test/WireMock.Net.Tests/Owin/GlobalExceptionMiddlewareTests.cs
@@ -39,7 +39,7 @@ namespace WireMock.Net.Tests.Owin
public void GlobalExceptionMiddleware_Invoke_NullAsNext_DoesNotInvokeNextAndDoesNotThrow()
{
// Act
- Check.ThatAsyncCode(() => _sut.Invoke(null)).DoesNotThrow();
+ Check.ThatCode(() => _sut.Invoke(null)).DoesNotThrow();
}
}
}
\ No newline at end of file
diff --git a/test/WireMock.Net.Tests/RequestMatchers/RequestMessageMultiPartMatcher.cs b/test/WireMock.Net.Tests/RequestMatchers/RequestMessageMultiPartMatcher.cs
index 36e2bda2..348dc604 100644
--- a/test/WireMock.Net.Tests/RequestMatchers/RequestMessageMultiPartMatcher.cs
+++ b/test/WireMock.Net.Tests/RequestMatchers/RequestMessageMultiPartMatcher.cs
@@ -1,6 +1,6 @@
// Copyright © WireMock.Net
-#if MIMEKIT
+//#if MIMEKIT
using System;
using System.Collections.Generic;
using System.Linq;
@@ -178,4 +178,4 @@ AAAADElEQVR4XmMQYNgAAADkAMHebX3mAAAAAElFTkSuQmCC
return matcher.GetMatchingScore(requestMessage, result);
}
}
-#endif
\ No newline at end of file
+//#endif
\ No newline at end of file
diff --git a/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithHandlebarsFileTests.cs b/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithHandlebarsFileTests.cs
index 3528038a..0b961c59 100644
--- a/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithHandlebarsFileTests.cs
+++ b/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithHandlebarsFileTests.cs
@@ -105,7 +105,7 @@ public class ResponseWithHandlebarsFileTests
.WithTransformer();
// Act
- Check.ThatAsyncCode(() => responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings)).Throws();
+ Check.ThatCode(() => responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings)).Throws();
// Verify
_filesystemHandlerMock.Verify(fs => fs.ReadResponseBodyAsString(It.IsAny()), Times.Never);
diff --git a/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithHandlebarsJsonPathTests.cs b/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithHandlebarsJsonPathTests.cs
index b8933dc8..a6b75caa 100644
--- a/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithHandlebarsJsonPathTests.cs
+++ b/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithHandlebarsJsonPathTests.cs
@@ -350,7 +350,7 @@ public class ResponseWithHandlebarsJsonPathTests
.WithTransformer();
// Act
- Check.ThatAsyncCode(() => responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings)).Throws();
+ Check.ThatCode(() => responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings)).Throws();
}
[Fact]
diff --git a/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithHandlebarsLinqTests.cs b/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithHandlebarsLinqTests.cs
index bfd7121a..cdad36f4 100644
--- a/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithHandlebarsLinqTests.cs
+++ b/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithHandlebarsLinqTests.cs
@@ -162,7 +162,7 @@ public class ResponseWithHandlebarsLinqTests
.WithTransformer();
// Act
- Check.ThatAsyncCode(() => responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings)).Throws();
+ Check.ThatCode(() => responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings)).Throws();
}
[Fact]
@@ -178,7 +178,7 @@ public class ResponseWithHandlebarsLinqTests
.WithTransformer();
// Act
- Check.ThatAsyncCode(() => responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings)).Throws();
+ Check.ThatCode(() => responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings)).Throws();
}
[Fact]
diff --git a/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithHandlebarsRegexTests.cs b/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithHandlebarsRegexTests.cs
index 6109b02d..f194ff31 100644
--- a/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithHandlebarsRegexTests.cs
+++ b/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithHandlebarsRegexTests.cs
@@ -120,6 +120,6 @@ public class ResponseWithHandlebarsRegexTests
.WithTransformer();
// Act and Assert
- Check.ThatAsyncCode(() => responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings)).Throws();
+ Check.ThatCode(() => responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings)).Throws();
}
}
\ No newline at end of file
diff --git a/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithProxyTests.cs b/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithProxyTests.cs
index ba66619b..001190e9 100644
--- a/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithProxyTests.cs
+++ b/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithProxyTests.cs
@@ -84,7 +84,7 @@ public class ResponseWithProxyTests : IDisposable
// Act
var request = new RequestMessage(new UrlDetails($"{_server.Urls[0]}/{_guid}"), "GET", ClientIp);
- Check.ThatAsyncCode(() => responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings)).Throws();
+ Check.ThatCode(() => responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings)).Throws();
}
public void Dispose()
diff --git a/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithTransformerTests.cs b/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithTransformerTests.cs
index 9f663fd0..ee928b7c 100644
--- a/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithTransformerTests.cs
+++ b/test/WireMock.Net.Tests/ResponseBuilders/ResponseWithTransformerTests.cs
@@ -779,7 +779,7 @@ public class ResponseWithTransformerTests
response.Message.BodyData.Encoding.Should().Be(enc);
}
-#if MIMEKIT
+//#if MIMEKIT
[Theory]
[InlineData(TransformerType.Handlebars)]
// [InlineData(TransformerType.Scriban)]
@@ -825,12 +825,12 @@ AAAADElEQVR4XmMQYNgAAADkAMHebX3mAAAAAElFTkSuQmCC
.WithTransformer(transformerType);
// Act
- var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings).ConfigureAwait(false);
+ var response = await responseBuilder.ProvideResponseAsync(_mappingMock.Object, request, _settings);
// Assert
response.Message.BodyData!.BodyAsString.Should().Be("text/plain text/json image.png");
}
-#endif
+//#endif
[Theory]
[InlineData("/wiremock-data/1", "one")]
diff --git a/test/WireMock.Net.Tests/Serialization/MatcherMapperTests.cs b/test/WireMock.Net.Tests/Serialization/MatcherMapperTests.cs
index 3b069fb2..7bdc2d73 100644
--- a/test/WireMock.Net.Tests/Serialization/MatcherMapperTests.cs
+++ b/test/WireMock.Net.Tests/Serialization/MatcherMapperTests.cs
@@ -62,7 +62,7 @@ public class MatcherMapperTests
models.Should().HaveCount(2);
}
-#if MIMEKIT
+//#if MIMEKIT
[Fact]
public void MatcherMapper_Map_Matcher_MimePartMatcher()
{
@@ -94,7 +94,7 @@ public class MatcherMapperTests
model.ContentMatcher!.Name.Should().Be(nameof(ExactObjectMatcher));
model.ContentMatcher.Pattern.Should().Be(bytes);
}
-#endif
+//#endif
[Fact]
public void MatcherMapper_Map_Matcher_IStringMatcher()
@@ -598,7 +598,7 @@ message HelloReply {
matcher.MatchBehaviour.Should().Be(MatchBehaviour.RejectOnMatch);
}
-#if MIMEKIT
+//#if MIMEKIT
[Fact]
public void MatcherMapper_Map_MatcherModel_MimePartMatcher()
{
@@ -638,7 +638,7 @@ message HelloReply {
matcher.ContentTransferEncodingMatcher.Should().BeAssignableTo().Which.GetPatterns().Should().ContainSingle("z");
matcher.ContentTypeMatcher.Should().BeAssignableTo().Which.GetPatterns().Should().ContainSingle("text/json");
}
-#endif
+//#endif
[Fact]
public void MatcherMapper_Map_MatcherModel_XPathMatcher_WithXmlNamespaces_As_String()
diff --git a/test/WireMock.Net.Tests/WireMock.Net.Tests.csproj b/test/WireMock.Net.Tests/WireMock.Net.Tests.csproj
index 3602674f..56aae5e5 100644
--- a/test/WireMock.Net.Tests/WireMock.Net.Tests.csproj
+++ b/test/WireMock.Net.Tests/WireMock.Net.Tests.csproj
@@ -2,7 +2,7 @@
Stef Heyenrath
- net452;net461;net6.0;net8.0
+ net48;net8.0
enable
false
full
@@ -21,15 +21,19 @@
true
-
+
+
+
+ $(DefineConstants);GRAPHQL;MIMEKIT;PROTOBUF
-
+
$(DefineConstants);TRAILINGHEADERS
@@ -64,21 +68,40 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
+
+
+
-
-
+
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
-
+
-
+
+
+
+
+
-
+
+
+
@@ -133,26 +165,26 @@
PreserveNewest
- PreserveNewest
+ PreserveNewest
- PreserveNewest
-
+ PreserveNewest
+
- PreserveNewest
-
+ PreserveNewest
+
- PreserveNewest
- Client
+ PreserveNewest
+ Client
Client
PreserveNewest
- PreserveNewest
+ PreserveNewest
PreserveNewest
diff --git a/test/WireMock.Net.Tests/WireMockServerTests.ClientCertificate.cs b/test/WireMock.Net.Tests/WireMockServerTests.ClientCertificate.cs
index 93ee9a84..cee6e056 100644
--- a/test/WireMock.Net.Tests/WireMockServerTests.ClientCertificate.cs
+++ b/test/WireMock.Net.Tests/WireMockServerTests.ClientCertificate.cs
@@ -1,7 +1,6 @@
// Copyright © WireMock.Net
-#if !NET451 && !NET452
-
+//#if !NET451 && !NET452
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
@@ -49,13 +48,10 @@ public partial class WireMockServerTests
httpMessageHandler.ClientCertificates.AddRange(certificates);
// Act
- var response = await new HttpClient(httpMessageHandler)
- .GetAsync("https://localhost:" + server.Ports[0] + "/foo")
- .ConfigureAwait(false);
+ var response = await new HttpClient(httpMessageHandler).GetAsync("https://localhost:" + server.Ports[0] + "/foo");
// Assert
response.StatusCode.Should().Be(HttpStatusCode.OK);
}
}
-
-#endif
\ No newline at end of file
+//#endif
\ No newline at end of file
diff --git a/test/WireMock.Net.Tests/WireMockServerTests.WithBody.cs b/test/WireMock.Net.Tests/WireMockServerTests.WithBody.cs
index 217588c1..f02163f7 100644
--- a/test/WireMock.Net.Tests/WireMockServerTests.WithBody.cs
+++ b/test/WireMock.Net.Tests/WireMockServerTests.WithBody.cs
@@ -7,6 +7,7 @@ using System.IO;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
+using System.Net.Http.Json;
using System.Text;
using System.Threading.Tasks;
using FluentAssertions;
diff --git a/test/WireMock.Net.Tests/WireMockServerTests.WithMultiPart.cs b/test/WireMock.Net.Tests/WireMockServerTests.WithMultiPart.cs
index ef9c23ef..bfbe4067 100644
--- a/test/WireMock.Net.Tests/WireMockServerTests.WithMultiPart.cs
+++ b/test/WireMock.Net.Tests/WireMockServerTests.WithMultiPart.cs
@@ -1,6 +1,6 @@
// Copyright © WireMock.Net
-#if MIMEKIT
+//#if MIMEKIT
using System;
using System.Net;
using System.Net.Http;
@@ -74,4 +74,4 @@ public partial class WireMockServerTests
server.Stop();
}
}
-#endif
\ No newline at end of file
+//#endif
\ No newline at end of file
diff --git a/test/WireMock.Net.Tests/WireMockServerTests.cs b/test/WireMock.Net.Tests/WireMockServerTests.cs
index acd4d44d..2641f2b1 100644
--- a/test/WireMock.Net.Tests/WireMockServerTests.cs
+++ b/test/WireMock.Net.Tests/WireMockServerTests.cs
@@ -102,7 +102,7 @@ public partial class WireMockServerTests
// then
Check.That(server.Mappings).IsEmpty();
- Check.ThatAsyncCode(() => new HttpClient().GetStringAsync("http://localhost:" + server.Ports[0] + path)).ThrowsAny();
+ Check.ThatCode(() => new HttpClient().GetStringAsync("http://localhost:" + server.Ports[0] + path)).ThrowsAny();
server.Stop();
}