mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-06-06 13:52:46 +02:00
Add SystemTextJsonMatchers (#1447)
* SystemTextJsonMatcher * , * . * new projectx * Update test/WireMock.Net.Tests/Pact/PactTests.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update test/WireMock.Net.Tests/WebSockets/WebSocketIntegrationTests.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/WireMock.Net/WireMock.Net.csproj Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/WireMock.Net.Minimal/Properties/AssemblyInfo.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * . * more tests * . * . * x * ... * . * fix tests * 0.11.0 * . * delete jsonutils.cs * s * fix findings * Apply suggestions from code review Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> * Potential fix for pull request finding 'Missing Dispose call on local IDisposable' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> * JsonConverter 0.12.0 * -- tools --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// Copyright © WireMock.Net
|
||||
|
||||
using System.Collections;
|
||||
using JsonConverter.Abstractions;
|
||||
using WireMock.Extensions;
|
||||
using WireMock.Util;
|
||||
|
||||
@@ -191,9 +192,9 @@ internal class SimpleSettingsParser
|
||||
return GetValue(name, values => values.FirstOrDefault());
|
||||
}
|
||||
|
||||
public T? GetObjectValueFromJson<T>(string name)
|
||||
public T? GetObjectValueFromJson<T>(string name, IJsonConverter jsonConverter)
|
||||
{
|
||||
var value = GetValue(name, values => values.FirstOrDefault());
|
||||
return string.IsNullOrWhiteSpace(value) ? default : JsonUtils.DeserializeObject<T>(value!);
|
||||
return string.IsNullOrWhiteSpace(value) ? default : jsonConverter.Deserialize<T>(value!);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user