mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 15:42:48 -05:00
Fix failing tests (#2095)
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
using System.Text.Json;
|
||||
using System.Globalization;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using NS = Newtonsoft.Json;
|
||||
|
||||
@ -140,14 +141,15 @@ namespace Bit.Core.Utilities
|
||||
/// </summary>
|
||||
public class PermissiveStringConverter : JsonConverter<string>
|
||||
{
|
||||
internal static PermissiveStringConverter Instance = new();
|
||||
internal static readonly PermissiveStringConverter Instance = new();
|
||||
private static readonly CultureInfo _cultureInfo = new("en-US");
|
||||
|
||||
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
return reader.TokenType switch
|
||||
{
|
||||
JsonTokenType.String => reader.GetString(),
|
||||
JsonTokenType.Number => reader.GetDecimal().ToString(),
|
||||
JsonTokenType.Number => reader.GetDecimal().ToString(_cultureInfo),
|
||||
JsonTokenType.True => bool.TrueString,
|
||||
JsonTokenType.False => bool.FalseString,
|
||||
_ => throw new JsonException($"Unsupported TokenType: {reader.TokenType}"),
|
||||
|
Reference in New Issue
Block a user