mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-07-02 11:01:50 +02:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 56c606e1c4 | |||
| cbc28c235c | |||
| dd1aa5139e | |||
| 89b3149732 |
@@ -1,3 +1,8 @@
|
|||||||
|
# 2.11.0 (12 June 2026)
|
||||||
|
- [#1475](https://github.com/wiremock/WireMock.Net/pull/1475) - Update NuGet packages (Aspire, MessagePack and more) [security] contributed by [StefH](https://github.com/StefH)
|
||||||
|
- [#1476](https://github.com/wiremock/WireMock.Net/pull/1476) - Fix BodyParser [bug] contributed by [StefH](https://github.com/StefH)
|
||||||
|
- [#1473](https://github.com/wiremock/WireMock.Net/issues/1473) - JsonPartialWildCardMatcher With DateTime Regex Stopped Matching (Regression?) [bug]
|
||||||
|
|
||||||
# 2.10.0 (07 June 2026)
|
# 2.10.0 (07 June 2026)
|
||||||
- [#1472](https://github.com/wiremock/WireMock.Net/pull/1472) - Update JsonConverter to 0.13.0 [bug] contributed by [StefH](https://github.com/StefH)
|
- [#1472](https://github.com/wiremock/WireMock.Net/pull/1472) - Update JsonConverter to 0.13.0 [bug] contributed by [StefH](https://github.com/StefH)
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<VersionPrefix>2.10.0</VersionPrefix>
|
<VersionPrefix>2.11.0</VersionPrefix>
|
||||||
<PackageIcon>WireMock.Net-Logo.png</PackageIcon>
|
<PackageIcon>WireMock.Net-Logo.png</PackageIcon>
|
||||||
<PackageProjectUrl>https://github.com/wiremock/WireMock.Net</PackageProjectUrl>
|
<PackageProjectUrl>https://github.com/wiremock/WireMock.Net</PackageProjectUrl>
|
||||||
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
|
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
rem https://github.com/StefH/GitHubReleaseNotes
|
rem https://github.com/StefH/GitHubReleaseNotes
|
||||||
|
|
||||||
SET version=2.10.0
|
SET version=2.11.0
|
||||||
|
|
||||||
GitHubReleaseNotes --output CHANGELOG.md --skip-empty-releases --exclude-labels wontfix test question invalid doc duplicate example environment --version %version% --token %GH_TOKEN%
|
GitHubReleaseNotes --output CHANGELOG.md --skip-empty-releases --exclude-labels wontfix test question invalid doc duplicate example environment --version %version% --token %GH_TOKEN%
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
# 2.10.0 (07 June 2026)
|
# 2.11.0 (12 June 2026)
|
||||||
- #1472 Update JsonConverter to 0.13.0 [bug]
|
- #1475 Update NuGet packages (Aspire, MessagePack and more) [security]
|
||||||
|
- #1476 Fix BodyParser [bug]
|
||||||
|
- #1473 JsonPartialWildCardMatcher With DateTime Regex Stopped Matching (Regression?) [bug]
|
||||||
|
|
||||||
The full release notes can be found here: https://github.com/wiremock/WireMock.Net/blob/master/CHANGELOG.md
|
The full release notes can be found here: https://github.com/wiremock/WireMock.Net/blob/master/CHANGELOG.md
|
||||||
@@ -18,7 +18,10 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Aspire.Hosting.AppHost" Version="13.4.0" />
|
<PackageReference Include="Aspire.Hosting.AppHost" Version="13.4.3" />
|
||||||
|
|
||||||
|
<!-- CVE-2026-48109 -->
|
||||||
|
<PackageReference Include="MessagePack" Version="2.5.302" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -15,7 +15,10 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Aspire.Hosting.AppHost" Version="13.4.0" />
|
<PackageReference Include="Aspire.Hosting.AppHost" Version="13.4.3" />
|
||||||
|
|
||||||
|
<!-- CVE-2026-48109 -->
|
||||||
|
<PackageReference Include="MessagePack" Version="2.5.302" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Google.Protobuf" Version="3.25.1" />
|
<PackageReference Include="Google.Protobuf" Version="3.33.5" />
|
||||||
<PackageReference Include="Grpc.Net.Client" Version="2.60.0" />
|
<PackageReference Include="Grpc.Net.Client" Version="2.76.0" />
|
||||||
<PackageReference Include="Grpc.Tools" Version="2.60.0">
|
<PackageReference Include="Grpc.Tools" Version="2.78.0">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
// Copyright © WireMock.Net
|
// Copyright © WireMock.Net
|
||||||
|
|
||||||
using System.IO;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using log4net;
|
using log4net;
|
||||||
using log4net.Config;
|
using log4net.Config;
|
||||||
using log4net.Repository;
|
using log4net.Repository;
|
||||||
@@ -12,7 +10,7 @@ namespace WireMock.Net.Console.NET8;
|
|||||||
|
|
||||||
static class Program
|
static class Program
|
||||||
{
|
{
|
||||||
private static readonly ILoggerRepository LogRepository = LogManager.GetRepository(Assembly.GetEntryAssembly());
|
private static readonly ILoggerRepository LogRepository = LogManager.GetRepository(Assembly.GetEntryAssembly()!);
|
||||||
private static readonly ILog Log = LogManager.GetLogger(typeof(Program));
|
private static readonly ILog Log = LogManager.GetLogger(typeof(Program));
|
||||||
|
|
||||||
static async Task Main(params string[] args)
|
static async Task Main(params string[] args)
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="WireMock.Net" Version="2.6.0" />
|
<PackageReference Include="WireMock.Net" Version="2.10.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -97,7 +97,7 @@
|
|||||||
<Version>2.3.9</Version>
|
<Version>2.3.9</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="WireMock.Net">
|
<PackageReference Include="WireMock.Net">
|
||||||
<Version>1.25.0</Version>
|
<Version>2.10.0</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public class WireMockService : IWireMockService
|
|||||||
|
|
||||||
_server = WireMockServer.Start(_settings);
|
_server = WireMockServer.Start(_settings);
|
||||||
|
|
||||||
_logger.LogInformation($"WireMock.Net server settings {JsonConvert.SerializeObject(_settings)}");
|
_logger.LogInformation("WireMock.Net server settings {Settings}", JsonConvert.SerializeObject(_settings));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Stop()
|
public void Stop()
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
</ItemGroup>-->
|
</ItemGroup>-->
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="FluentBuilder" Version="0.14.0">
|
<PackageReference Include="FluentBuilder" Version="0.15.0">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
|||||||
@@ -45,7 +45,10 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Aspire.Hosting" Version="13.4.0" />
|
<PackageReference Include="Aspire.Hosting" Version="13.4.3" />
|
||||||
|
|
||||||
|
<!-- CVE-2026-48109 -->
|
||||||
|
<PackageReference Include="MessagePack" Version="2.5.302" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Stef.Validation" Version="0.2.0" />
|
<PackageReference Include="Stef.Validation" Version="0.3.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Condition="'$(Configuration)' == 'Debug'">
|
<ItemGroup Condition="'$(Configuration)' == 'Debug'">
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="JsonConverter.Newtonsoft.Json" Version="0.13.0" />
|
<PackageReference Include="JsonConverter.Newtonsoft.Json" Version="0.13.0" />
|
||||||
<PackageReference Include="NUnit" Version="4.4.0" />
|
<PackageReference Include="NUnit" Version="4.4.0" />
|
||||||
<PackageReference Include="Stef.Validation" Version="0.2.0" />
|
<PackageReference Include="Stef.Validation" Version="0.3.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
<PackageReference Include="RamlToOpenApiConverter.SourceOnly" Version="0.11.0" />
|
<PackageReference Include="RamlToOpenApiConverter.SourceOnly" Version="0.11.0" />
|
||||||
<PackageReference Include="YamlDotNet" Version="16.3.0" />
|
<PackageReference Include="YamlDotNet" Version="16.3.0" />
|
||||||
<PackageReference Include="RandomDataGenerator.Net" Version="1.0.19.1" />
|
<PackageReference Include="RandomDataGenerator.Net" Version="1.0.19.1" />
|
||||||
<PackageReference Include="Stef.Validation" Version="0.2.0" />
|
<PackageReference Include="Stef.Validation" Version="0.3.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Condition="'$(Configuration)' == 'Debug'">
|
<ItemGroup Condition="'$(Configuration)' == 'Debug'">
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="JsonConverter.Newtonsoft.Json" Version="0.13.0" />
|
<PackageReference Include="JsonConverter.Newtonsoft.Json" Version="0.13.0" />
|
||||||
<PackageReference Include="RestEase" Version="1.6.4" />
|
<PackageReference Include="RestEase" Version="1.6.4" />
|
||||||
<PackageReference Include="Stef.Validation" Version="0.2.0" />
|
<PackageReference Include="Stef.Validation" Version="0.3.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -305,12 +305,6 @@ public class WireMockServerSettings
|
|||||||
[PublicAPI, JsonIgnore]
|
[PublicAPI, JsonIgnore]
|
||||||
public IDictionary<string, Func<MatcherModel, IMatcher>>? CustomMatcherMappings { get; set; }
|
public IDictionary<string, Func<MatcherModel, IMatcher>>? CustomMatcherMappings { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The <see cref="JsonSerializerSettings"/> used when the JSON response is generated.
|
|
||||||
/// </summary>
|
|
||||||
[PublicAPI, JsonIgnore]
|
|
||||||
public JsonSerializerSettings? JsonSerializerSettings { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The Culture to use.
|
/// The Culture to use.
|
||||||
/// Currently used for:
|
/// Currently used for:
|
||||||
@@ -363,6 +357,7 @@ public class WireMockServerSettings
|
|||||||
/// Default is <see cref="NewtonsoftJsonConverter"/>.
|
/// Default is <see cref="NewtonsoftJsonConverter"/>.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
|
[JsonConverter(typeof(WireMockSettingsJsonConverter))]
|
||||||
public IJsonConverter DefaultJsonSerializer { get; set; }
|
public IJsonConverter DefaultJsonSerializer { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -373,7 +368,7 @@ public class WireMockServerSettings
|
|||||||
/// Default is <see cref="NewtonsoftJsonBodyTransformer"/>.
|
/// Default is <see cref="NewtonsoftJsonBodyTransformer"/>.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
[JsonIgnore]
|
[JsonConverter(typeof(WireMockSettingsJsonConverter))]
|
||||||
public IJsonBodyTransformer DefaultJsonBodyTransformer { get; set; }
|
public IJsonBodyTransformer DefaultJsonBodyTransformer { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -0,0 +1,151 @@
|
|||||||
|
// Copyright © WireMock.Net
|
||||||
|
|
||||||
|
using System.Reflection;
|
||||||
|
using JsonConverter.Abstractions;
|
||||||
|
using JsonConverter.Newtonsoft.Json;
|
||||||
|
using JsonConverter.System.Text.Json;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using WireMock.Transformers;
|
||||||
|
using NewtonsoftJsonConverterBase = Newtonsoft.Json.JsonConverter;
|
||||||
|
|
||||||
|
namespace WireMock.Settings;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// WireMockSettingsJsonConverter serializes and deserializes the special interface-based settings properties as type names.
|
||||||
|
/// </summary>
|
||||||
|
public class WireMockSettingsJsonConverter : NewtonsoftJsonConverterBase
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override bool CanConvert(Type objectType)
|
||||||
|
{
|
||||||
|
return typeof(IJsonConverter).IsAssignableFrom(objectType) || typeof(IJsonBodyTransformer).IsAssignableFrom(objectType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
|
||||||
|
{
|
||||||
|
writer.WriteValue(value?.GetType().FullName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
|
||||||
|
{
|
||||||
|
if (reader.TokenType == JsonToken.Null)
|
||||||
|
{
|
||||||
|
return existingValue ?? CreateDefaultValue(objectType);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reader.TokenType != JsonToken.String)
|
||||||
|
{
|
||||||
|
reader.Skip();
|
||||||
|
return existingValue ?? CreateDefaultValue(objectType);
|
||||||
|
}
|
||||||
|
|
||||||
|
var typeName = reader.Value as string;
|
||||||
|
|
||||||
|
if (typeof(IJsonConverter).IsAssignableFrom(objectType))
|
||||||
|
{
|
||||||
|
return CreateJsonConverter(typeName) ?? existingValue ?? new NewtonsoftJsonConverter();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof(IJsonBodyTransformer).IsAssignableFrom(objectType))
|
||||||
|
{
|
||||||
|
var settings = ExtractSettings(existingValue as IJsonBodyTransformer);
|
||||||
|
return settings != null
|
||||||
|
? CreateJsonBodyTransformer(typeName, settings) ?? existingValue ?? new NewtonsoftJsonBodyTransformer(settings)
|
||||||
|
: existingValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return existingValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static object? CreateDefaultValue(Type objectType)
|
||||||
|
{
|
||||||
|
if (typeof(IJsonConverter).IsAssignableFrom(objectType))
|
||||||
|
{
|
||||||
|
return new NewtonsoftJsonConverter();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IJsonConverter? CreateJsonConverter(string? typeName)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(typeName))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeName == nameof(NewtonsoftJsonConverter) || typeName == typeof(NewtonsoftJsonConverter).FullName)
|
||||||
|
{
|
||||||
|
return new NewtonsoftJsonConverter();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeName == nameof(SystemTextJsonConverter) || typeName == typeof(SystemTextJsonConverter).FullName)
|
||||||
|
{
|
||||||
|
return new SystemTextJsonConverter();
|
||||||
|
}
|
||||||
|
|
||||||
|
var type = GetType(typeName);
|
||||||
|
if (type == null || !typeof(IJsonConverter).IsAssignableFrom(type))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Activator.CreateInstance(type) as IJsonConverter;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IJsonBodyTransformer? CreateJsonBodyTransformer(string? typeName, WireMockServerSettings settings)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(typeName))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeName == nameof(NewtonsoftJsonBodyTransformer) || typeName == typeof(NewtonsoftJsonBodyTransformer).FullName)
|
||||||
|
{
|
||||||
|
return new NewtonsoftJsonBodyTransformer(settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeName == nameof(SystemTextJsonBodyTransformer) || typeName == typeof(SystemTextJsonBodyTransformer).FullName)
|
||||||
|
{
|
||||||
|
return new SystemTextJsonBodyTransformer(settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
var type = GetType(typeName);
|
||||||
|
if (type == null || !typeof(IJsonBodyTransformer).IsAssignableFrom(type))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var constructorWithSettings = type.GetConstructor([typeof(WireMockServerSettings)]);
|
||||||
|
if (constructorWithSettings != null)
|
||||||
|
{
|
||||||
|
return constructorWithSettings.Invoke([settings]) as IJsonBodyTransformer;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Activator.CreateInstance(type) as IJsonBodyTransformer;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static WireMockServerSettings? ExtractSettings(IJsonBodyTransformer? existingValue)
|
||||||
|
{
|
||||||
|
if (existingValue == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return existingValue.GetType()
|
||||||
|
.GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public)
|
||||||
|
.Where(field => typeof(WireMockServerSettings).IsAssignableFrom(field.FieldType))
|
||||||
|
.Select(field => field.GetValue(existingValue) as WireMockServerSettings)
|
||||||
|
.FirstOrDefault(settings => settings != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Type? GetType(string typeName)
|
||||||
|
{
|
||||||
|
return Type.GetType(typeName, throwOnError: false) ??
|
||||||
|
AppDomain.CurrentDomain.GetAssemblies()
|
||||||
|
.Select(assembly => assembly.GetType(typeName, throwOnError: false))
|
||||||
|
.FirstOrDefault(foundType => foundType != null);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ using System.Text;
|
|||||||
using Stef.Validation;
|
using Stef.Validation;
|
||||||
using WireMock.Constants;
|
using WireMock.Constants;
|
||||||
using WireMock.Matchers;
|
using WireMock.Matchers;
|
||||||
|
using WireMock.Serialization;
|
||||||
using WireMock.Types;
|
using WireMock.Types;
|
||||||
|
|
||||||
namespace WireMock.Util;
|
namespace WireMock.Util;
|
||||||
@@ -25,7 +26,7 @@ internal static class BodyParser
|
|||||||
CONNECT - No defined body semantics
|
CONNECT - No defined body semantics
|
||||||
PATCH - Body supported.
|
PATCH - Body supported.
|
||||||
*/
|
*/
|
||||||
private static readonly IDictionary<string, bool> BodyAllowedForMethods = new Dictionary<string, bool>
|
private static readonly Dictionary<string, bool> BodyAllowedForMethods = new()
|
||||||
{
|
{
|
||||||
{ HttpRequestMethod.HEAD, false },
|
{ HttpRequestMethod.HEAD, false },
|
||||||
{ HttpRequestMethod.GET, false },
|
{ HttpRequestMethod.GET, false },
|
||||||
@@ -173,7 +174,7 @@ internal static class BodyParser
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
data.BodyAsJson = settings.DefaultJsonConverter.Deserialize<object>(data.BodyAsString);
|
data.BodyAsJson = settings.DefaultJsonConverter.Deserialize<object>(data.BodyAsString, JsonSerializationConstants.JsonConverterOptionsWithDateParsingNone);
|
||||||
data.DetectedBodyType = BodyType.Json;
|
data.DetectedBodyType = BodyType.Json;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.3.9" />
|
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.3.9" />
|
||||||
<PackageReference Include="Stef.Validation" Version="0.2.0" />
|
<PackageReference Include="Stef.Validation" Version="0.3.0" />
|
||||||
<PackageReference Include="AnyOf" Version="0.5.0.1" />
|
<PackageReference Include="AnyOf" Version="0.5.0.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
|
||||||
<PackageReference Include="JsonConverter.Newtonsoft.Json" Version="0.13.0" />
|
<PackageReference Include="JsonConverter.Newtonsoft.Json" Version="0.13.0" />
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||||
<PackageReference Include="Stef.Validation" Version="0.2.0" />
|
<PackageReference Include="Stef.Validation" Version="0.3.0" />
|
||||||
<PackageReference Include="TUnit.Core" Version="1.17.29" />
|
<PackageReference Include="TUnit.Core" Version="1.17.29" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Stef.Validation" Version="0.2.0" />
|
<PackageReference Include="Stef.Validation" Version="0.3.0" />
|
||||||
<PackageReference Include="Testcontainers" Version="4.12.0" />
|
<PackageReference Include="Testcontainers" Version="4.12.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||||
<PackageReference Include="Stef.Validation" Version="0.2.0" />
|
<PackageReference Include="Stef.Validation" Version="0.3.0" />
|
||||||
<PackageReference Include="xunit.v3.extensibility.core" Version="3.2.2" />
|
<PackageReference Include="xunit.v3.extensibility.core" Version="3.2.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||||
<PackageReference Include="Stef.Validation" Version="0.2.0" />
|
<PackageReference Include="Stef.Validation" Version="0.3.0" />
|
||||||
<PackageReference Include="xUnit.abstractions" Version="2.0.3" />
|
<PackageReference Include="xUnit.abstractions" Version="2.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
// Copyright © WireMock.Net
|
// Copyright © WireMock.Net
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using WireMock.Logging;
|
using WireMock.Logging;
|
||||||
using WireMock.Net.StandAlone;
|
using WireMock.Net.StandAlone;
|
||||||
|
|||||||
@@ -19,7 +19,10 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Aspire.Hosting.AppHost" Version="13.4.0" />
|
<PackageReference Include="Aspire.Hosting.AppHost" Version="13.4.3" />
|
||||||
|
|
||||||
|
<!-- CVE-2026-48109 -->
|
||||||
|
<PackageReference Include="MessagePack" Version="2.5.302" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Aspire.Hosting.Testing" Version="13.4.0" />
|
<PackageReference Include="Aspire.Hosting.Testing" Version="13.4.3" />
|
||||||
<PackageReference Include="Codecov" Version="1.13.0" />
|
<PackageReference Include="Codecov" Version="1.13.0" />
|
||||||
<PackageReference Include="coverlet.msbuild" Version="6.0.4">
|
<PackageReference Include="coverlet.msbuild" Version="6.0.4">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
@@ -32,6 +32,9 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
|
||||||
|
<!-- CVE-2026-48109 -->
|
||||||
|
<PackageReference Include="MessagePack" Version="2.5.302" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AwesomeAssertions" Version="9.4.0" />
|
<PackageReference Include="AwesomeAssertions" Version="9.4.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.6.0" />
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.4">
|
<PackageReference Include="coverlet.collector" Version="6.0.4">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="AwesomeAssertions" Version="9.4.0" />
|
<PackageReference Include="AwesomeAssertions" Version="9.4.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.8" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.8" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.6.0" />
|
||||||
<PackageReference Include="Moq" Version="4.20.72" />
|
<PackageReference Include="Moq" Version="4.20.72" />
|
||||||
<PackageReference Include="xunit.v3" Version="3.2.2" />
|
<PackageReference Include="xunit.v3" Version="3.2.2" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
|
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.6.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.6.0" />
|
||||||
<PackageReference Include="WireMock.Net" Version="2.9.0" />
|
<PackageReference Include="WireMock.Net" Version="2.10.0" />
|
||||||
<PackageReference Include="xunit.v3" Version="3.2.2" />
|
<PackageReference Include="xunit.v3" Version="3.2.2" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
|
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
|||||||
@@ -416,4 +416,20 @@ public class JsonPartialWildcardMatcherTests
|
|||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(1.0, match);
|
Assert.Equal(1.0, match);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void JsonPartialWildcardMatcher_IsMatch_WithRegexTrue_DateFormat_ShouldMatch()
|
||||||
|
{
|
||||||
|
// Assign
|
||||||
|
var matcher = new JsonPartialWildcardMatcher(
|
||||||
|
new { date = "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?(?:Z|[+-]\\d{2}:\\d{2})$", id = 1 },
|
||||||
|
ignoreCase: false,
|
||||||
|
regex: true);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var match = matcher.IsMatch("{\"date\":\"2026-06-09T22:23:18.53421+00:00\",\"id\":1}").Score;
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.Equal(1.0, match);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -379,4 +379,20 @@ public class SystemTextJsonPartialWildcardMatcherTests
|
|||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(1.0, match);
|
Assert.Equal(1.0, match);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
[Fact]
|
||||||
|
public void SystemTextJsonPartialWildcardMatcher_IsMatch_WithRegexTrue_DateFormat_ShouldMatch()
|
||||||
|
{
|
||||||
|
// Assign
|
||||||
|
var matcher = new SystemTextJsonPartialWildcardMatcher(
|
||||||
|
new { date = "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?(?:Z|[+-]\\d{2}:\\d{2})$", id = 1 },
|
||||||
|
ignoreCase: false,
|
||||||
|
regex: true);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var match = matcher.IsMatch("{\"date\":\"2026-06-09T22:23:18.53421+00:00\",\"id\":1}").Score;
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
Assert.Equal(1.0, match);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,82 @@
|
|||||||
|
// Copyright © WireMock.Net
|
||||||
|
|
||||||
|
using JsonConverter.Newtonsoft.Json;
|
||||||
|
using JsonConverter.System.Text.Json;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using WireMock.Settings;
|
||||||
|
using WireMock.Transformers;
|
||||||
|
|
||||||
|
namespace WireMock.Net.Tests.Settings;
|
||||||
|
|
||||||
|
public class WireMockServerSettingsJsonTests
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void NewtonsoftJson_Serialize_WireMockServerSettings_HandlesSpecialProperties_AndKeepsOtherPropertiesAsIs()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var settings = new WireMockServerSettings
|
||||||
|
{
|
||||||
|
Port = 1234,
|
||||||
|
AdminPath = "/custom-admin",
|
||||||
|
StartAdminInterface = true,
|
||||||
|
DefaultJsonSerializer = new SystemTextJsonConverter()
|
||||||
|
};
|
||||||
|
settings.DefaultJsonBodyTransformer = new SystemTextJsonBodyTransformer(settings);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var json = JsonConvert.SerializeObject(settings);
|
||||||
|
var jsonObject = JObject.Parse(json);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
jsonObject[nameof(WireMockServerSettings.Port)]!.Value<int>().Should().Be(1234);
|
||||||
|
jsonObject[nameof(WireMockServerSettings.AdminPath)]!.Value<string>().Should().Be("/custom-admin");
|
||||||
|
jsonObject[nameof(WireMockServerSettings.StartAdminInterface)]!.Value<bool>().Should().BeTrue();
|
||||||
|
jsonObject[nameof(WireMockServerSettings.DefaultJsonSerializer)]!.Type.Should().Be(JTokenType.String);
|
||||||
|
jsonObject[nameof(WireMockServerSettings.DefaultJsonSerializer)]!.Value<string>().Should().Be(typeof(SystemTextJsonConverter).FullName);
|
||||||
|
jsonObject[nameof(WireMockServerSettings.DefaultJsonBodyTransformer)]!.Type.Should().Be(JTokenType.String);
|
||||||
|
jsonObject[nameof(WireMockServerSettings.DefaultJsonBodyTransformer)]!.Value<string>().Should().Be(typeof(SystemTextJsonBodyTransformer).FullName);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void NewtonsoftJson_Deserialize_WireMockServerSettings_HandlesSpecialProperties_AndKeepsOtherPropertiesAsIs()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var json =
|
||||||
|
$"{{\"{nameof(WireMockServerSettings.Port)}\":4321," +
|
||||||
|
$"\"{nameof(WireMockServerSettings.AdminPath)}\":\"/custom-admin\"," +
|
||||||
|
$"\"{nameof(WireMockServerSettings.StartAdminInterface)}\":true," +
|
||||||
|
$"\"{nameof(WireMockServerSettings.DefaultJsonSerializer)}\":\"{typeof(SystemTextJsonConverter).FullName}\"," +
|
||||||
|
$"\"{nameof(WireMockServerSettings.DefaultJsonBodyTransformer)}\":\"{typeof(SystemTextJsonBodyTransformer).FullName}\"}}";
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var settings = JsonConvert.DeserializeObject<WireMockServerSettings>(json);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
settings.Should().NotBeNull();
|
||||||
|
settings!.Port.Should().Be(4321);
|
||||||
|
settings.AdminPath.Should().Be("/custom-admin");
|
||||||
|
settings.StartAdminInterface.Should().BeTrue();
|
||||||
|
settings.DefaultJsonSerializer.Should().BeOfType<SystemTextJsonConverter>();
|
||||||
|
settings.DefaultJsonBodyTransformer.Should().BeOfType<SystemTextJsonBodyTransformer>();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void NewtonsoftJson_Deserialize_WireMockServerSettings_LegacyObjects_AreIgnored_AndOtherPropertiesStayUntouched()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var json =
|
||||||
|
$"{{\"{nameof(WireMockServerSettings.Port)}\":9876," +
|
||||||
|
$"\"{nameof(WireMockServerSettings.DefaultJsonSerializer)}\":{{}}," +
|
||||||
|
$"\"{nameof(WireMockServerSettings.DefaultJsonBodyTransformer)}\":{{}}}}";
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var settings = JsonConvert.DeserializeObject<WireMockServerSettings>(json);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
settings.Should().NotBeNull();
|
||||||
|
settings!.Port.Should().Be(9876);
|
||||||
|
settings.DefaultJsonSerializer.Should().BeOfType<NewtonsoftJsonConverter>();
|
||||||
|
settings.DefaultJsonBodyTransformer.Should().BeOfType<NewtonsoftJsonBodyTransformer>();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.6.0" />
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.4">
|
<PackageReference Include="coverlet.collector" Version="6.0.4">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
|||||||
@@ -53,6 +53,81 @@ public partial class WireMockServerTests
|
|||||||
response.Should().BeEquivalentTo("{\"first_name\":\"John\",\"last_name\":\"Smith\"}");
|
response.Should().BeEquivalentTo("{\"first_name\":\"John\",\"last_name\":\"Smith\"}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task WireMockServer_WithBodyAsJson_WithJsonPartialWildcardMatcher()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
using var server = WireMockServer.Start(new WireMockServerSettings
|
||||||
|
{
|
||||||
|
Logger = new TestOutputHelperWireMockLogger(testOutputHelper)
|
||||||
|
});
|
||||||
|
server
|
||||||
|
.Given(
|
||||||
|
Request.Create()
|
||||||
|
.WithPath("/test")
|
||||||
|
.UsingPost()
|
||||||
|
.WithBody(new JsonPartialWildcardMatcher(
|
||||||
|
new
|
||||||
|
{
|
||||||
|
date = @"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$",
|
||||||
|
id = 1
|
||||||
|
},
|
||||||
|
ignoreCase: true,
|
||||||
|
regex: true
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.RespondWith(Response.Create().WithStatusCode(200).WithBody("matched"));
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var requestUri = new Uri($"http://localhost:{server.Port}/test");
|
||||||
|
|
||||||
|
var response = await server.CreateClient().PostAsync(requestUri, new StringContent("{\"date\":\"2026-06-09T22:23:18.53421+00:00\",\"id\":1}"), _ct);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
response.StatusCode.Should().Be(HttpStatusCode.OK);
|
||||||
|
|
||||||
|
server.Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task WireMockServer_WithBodyAsJson_WithSystemTextJsonPartialWildcardMatcher()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
using var server = WireMockServer.Start(new WireMockServerSettings
|
||||||
|
{
|
||||||
|
Logger = new TestOutputHelperWireMockLogger(testOutputHelper),
|
||||||
|
DefaultJsonSerializer = new SystemTextJsonConverter()
|
||||||
|
});
|
||||||
|
server
|
||||||
|
.Given(
|
||||||
|
Request.Create()
|
||||||
|
.WithPath("/test")
|
||||||
|
.UsingPost()
|
||||||
|
.WithBody(new SystemTextJsonPartialWildcardMatcher(
|
||||||
|
new
|
||||||
|
{
|
||||||
|
date = @"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$",
|
||||||
|
id = 1
|
||||||
|
},
|
||||||
|
ignoreCase: true,
|
||||||
|
regex: true
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.RespondWith(Response.Create().WithStatusCode(200).WithBody("matched"));
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var requestUri = new Uri($"http://localhost:{server.Port}/test");
|
||||||
|
|
||||||
|
var response = await server.CreateClient().PostAsync(requestUri, new StringContent("{\"date\":\"2026-06-09T22:23:18.53421+00:00\",\"id\":1}"), _ct);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
response.StatusCode.Should().Be(HttpStatusCode.OK);
|
||||||
|
|
||||||
|
server.Stop();
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task WireMockServer_WithBodyAsJson_Using_PostAsJsonAsync_And_MultipleJmesPathMatchers_ShouldMatch()
|
public async Task WireMockServer_WithBodyAsJson_Using_PostAsJsonAsync_And_MultipleJmesPathMatchers_ShouldMatch()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user