mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 08:02:49 -05:00
Start Migration from Newtonsoft.Json to System.Text.Json (#1803)
* Start switch to System.Text.Json * Work on switching to System.Text.Json * Main work on STJ refactor * Fix build errors * Run formatting * Delete unused file * Use legacy for two factor providers * Run formatter * Add TokenProviderTests * Run formatting * Fix merge issues * Switch to use JsonSerializer * Address PR feedback * Fix formatting * Ran formatter * Switch to async * Ensure Enums are serialized as strings * Fix formatting * Enqueue single items as arrays * Remove CreateAsync method on AzureQueueService
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Messaging.EventGrid;
|
||||
using Bit.Api.Models.Request;
|
||||
@ -21,7 +22,6 @@ using Core.Models.Data;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Bit.Api.Controllers
|
||||
{
|
||||
@ -802,7 +802,7 @@ namespace Bit.Api.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.LogError(e, $"Uncaught exception occurred while handling event grid event: {JsonConvert.SerializeObject(eventGridEvent)}");
|
||||
_logger.LogError(e, $"Uncaught exception occurred while handling event grid event: {JsonSerializer.Serialize(eventGridEvent)}");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Api.Models.Request;
|
||||
using Bit.Api.Models.Request.Accounts;
|
||||
@ -17,7 +18,6 @@ using Bit.Core.Settings;
|
||||
using Bit.Core.Utilities;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Bit.Api.Controllers
|
||||
{
|
||||
@ -185,7 +185,7 @@ namespace Bit.Api.Controllers
|
||||
return new OrganizationAutoEnrollStatusResponseModel(organization.Id, false);
|
||||
}
|
||||
|
||||
var data = JsonConvert.DeserializeObject<ResetPasswordDataModel>(resetPasswordPolicy.Data);
|
||||
var data = JsonSerializer.Deserialize<ResetPasswordDataModel>(resetPasswordPolicy.Data);
|
||||
return new OrganizationAutoEnrollStatusResponseModel(organization.Id, data?.AutoEnrollEnabled ?? false);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Messaging.EventGrid;
|
||||
using Bit.Api.Models.Request;
|
||||
@ -19,7 +20,6 @@ using Bit.Core.Utilities;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Bit.Api.Controllers
|
||||
{
|
||||
@ -227,7 +227,7 @@ namespace Bit.Api.Controllers
|
||||
var userId = _userService.GetProperUserId(User).Value;
|
||||
var sendId = new Guid(id);
|
||||
var send = await _sendRepository.GetByIdAsync(sendId);
|
||||
var fileData = JsonConvert.DeserializeObject<SendFileData>(send?.Data);
|
||||
var fileData = JsonSerializer.Deserialize<SendFileData>(send?.Data);
|
||||
|
||||
if (send == null || send.Type != SendType.File || (send.UserId.HasValue && send.UserId.Value != userId) ||
|
||||
!send.UserId.HasValue || fileData.Id != fileId || fileData.Validated)
|
||||
@ -289,7 +289,7 @@ namespace Bit.Api.Controllers
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.LogError(e, $"Uncaught exception occurred while handling event grid event: {JsonConvert.SerializeObject(eventGridEvent)}");
|
||||
_logger.LogError(e, $"Uncaught exception occurred while handling event grid event: {JsonSerializer.Serialize(eventGridEvent)}");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using System.Text.Json;
|
||||
using Bit.Core.Entities;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Bit.Api.Models.Public.Request
|
||||
{
|
||||
@ -17,7 +17,7 @@ namespace Bit.Api.Models.Public.Request
|
||||
public virtual Policy ToPolicy(Policy existingPolicy)
|
||||
{
|
||||
existingPolicy.Enabled = Enabled.GetValueOrDefault();
|
||||
existingPolicy.Data = Data != null ? JsonConvert.SerializeObject(Data) : null;
|
||||
existingPolicy.Data = Data != null ? JsonSerializer.Serialize(Data) : null;
|
||||
return existingPolicy;
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Newtonsoft.Json;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Api.Models.Public.Response
|
||||
{
|
||||
@ -24,7 +25,7 @@ namespace Bit.Api.Models.Public.Response
|
||||
Enabled = policy.Enabled;
|
||||
if (!string.IsNullOrWhiteSpace(policy.Data))
|
||||
{
|
||||
Data = JsonConvert.DeserializeObject<Dictionary<string, object>>(policy.Data);
|
||||
Data = JsonSerializer.Deserialize<Dictionary<string, object>>(policy.Data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,13 +2,14 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Utilities;
|
||||
using Core.Models.Data;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NS = Newtonsoft.Json;
|
||||
using NSL = Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Bit.Api.Models.Request
|
||||
{
|
||||
@ -69,22 +70,20 @@ namespace Bit.Api.Models.Request
|
||||
switch (existingCipher.Type)
|
||||
{
|
||||
case CipherType.Login:
|
||||
var loginObj = JObject.FromObject(ToCipherLoginData(),
|
||||
new JsonSerializer { NullValueHandling = NullValueHandling.Ignore });
|
||||
var loginObj = NSL.JObject.FromObject(ToCipherLoginData(),
|
||||
new NS.JsonSerializer { NullValueHandling = NS.NullValueHandling.Ignore });
|
||||
// TODO: Switch to JsonNode in .NET 6 https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-use-dom-utf8jsonreader-utf8jsonwriter?pivots=dotnet-6-0
|
||||
loginObj[nameof(CipherLoginData.Uri)]?.Parent?.Remove();
|
||||
existingCipher.Data = loginObj.ToString(Formatting.None);
|
||||
existingCipher.Data = loginObj.ToString(NS.Formatting.None);
|
||||
break;
|
||||
case CipherType.Card:
|
||||
existingCipher.Data = JsonConvert.SerializeObject(ToCipherCardData(),
|
||||
new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
|
||||
existingCipher.Data = JsonSerializer.Serialize(ToCipherCardData(), JsonHelpers.IgnoreWritingNull);
|
||||
break;
|
||||
case CipherType.Identity:
|
||||
existingCipher.Data = JsonConvert.SerializeObject(ToCipherIdentityData(),
|
||||
new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
|
||||
existingCipher.Data = JsonSerializer.Serialize(ToCipherIdentityData(), JsonHelpers.IgnoreWritingNull);
|
||||
break;
|
||||
case CipherType.SecureNote:
|
||||
existingCipher.Data = JsonConvert.SerializeObject(ToCipherSecureNoteData(),
|
||||
new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
|
||||
existingCipher.Data = JsonSerializer.Serialize(ToCipherSecureNoteData(), JsonHelpers.IgnoreWritingNull);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("Unsupported type: " + nameof(Type) + ".");
|
||||
|
@ -1,12 +1,12 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Exceptions;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Utilities;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Bit.Api.Models.Request
|
||||
{
|
||||
@ -65,15 +65,13 @@ namespace Bit.Api.Models.Request
|
||||
switch (existingSend.Type)
|
||||
{
|
||||
case SendType.File:
|
||||
var fileData = JsonConvert.DeserializeObject<SendFileData>(existingSend.Data);
|
||||
var fileData = JsonSerializer.Deserialize<SendFileData>(existingSend.Data);
|
||||
fileData.Name = Name;
|
||||
fileData.Notes = Notes;
|
||||
existingSend.Data = JsonConvert.SerializeObject(fileData,
|
||||
new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
|
||||
existingSend.Data = JsonSerializer.Serialize(fileData, JsonHelpers.IgnoreWritingNull);
|
||||
break;
|
||||
case SendType.Text:
|
||||
existingSend.Data = JsonConvert.SerializeObject(ToSendData(),
|
||||
new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
|
||||
existingSend.Data = JsonSerializer.Serialize(ToSendData(), JsonHelpers.IgnoreWritingNull);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("Unsupported type: " + nameof(Type) + ".");
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Bit.Api.Models.Request
|
||||
{
|
||||
@ -12,9 +12,9 @@ namespace Bit.Api.Models.Request
|
||||
|
||||
public User ToUser(User existingUser)
|
||||
{
|
||||
existingUser.EquivalentDomains = EquivalentDomains != null ? JsonConvert.SerializeObject(EquivalentDomains) : null;
|
||||
existingUser.EquivalentDomains = EquivalentDomains != null ? JsonSerializer.Serialize(EquivalentDomains) : null;
|
||||
existingUser.ExcludedGlobalEquivalentDomains = ExcludedGlobalEquivalentDomains != null ?
|
||||
JsonConvert.SerializeObject(ExcludedGlobalEquivalentDomains) : null;
|
||||
JsonSerializer.Serialize(ExcludedGlobalEquivalentDomains) : null;
|
||||
return existingUser;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Models.Data;
|
||||
@ -18,7 +19,7 @@ namespace Bit.Api.Models.Response
|
||||
Url = $"{globalSettings.Attachment.BaseUrl}/{cipher.Id}/{id}";
|
||||
FileName = data.FileName;
|
||||
Key = data.Key;
|
||||
Size = data.SizeString;
|
||||
Size = data.Size;
|
||||
SizeName = CoreHelpers.ReadableBytesSize(data.Size);
|
||||
}
|
||||
|
||||
@ -26,7 +27,8 @@ namespace Bit.Api.Models.Response
|
||||
public string Url { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public string Key { get; set; }
|
||||
public string Size { get; set; }
|
||||
[JsonNumberHandling(JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)]
|
||||
public long Size { get; set; }
|
||||
public string SizeName { get; set; }
|
||||
|
||||
public static IEnumerable<AttachmentResponseModel> FromCipher(Cipher cipher, IGlobalSettings globalSettings)
|
||||
|
@ -1,13 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Settings;
|
||||
using Core.Models.Data;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Bit.Api.Models.Response
|
||||
{
|
||||
@ -28,25 +28,25 @@ namespace Bit.Api.Models.Response
|
||||
switch (cipher.Type)
|
||||
{
|
||||
case CipherType.Login:
|
||||
var loginData = JsonConvert.DeserializeObject<CipherLoginData>(cipher.Data);
|
||||
var loginData = JsonSerializer.Deserialize<CipherLoginData>(cipher.Data);
|
||||
cipherData = loginData;
|
||||
Data = loginData;
|
||||
Login = new CipherLoginModel(loginData);
|
||||
break;
|
||||
case CipherType.SecureNote:
|
||||
var secureNoteData = JsonConvert.DeserializeObject<CipherSecureNoteData>(cipher.Data);
|
||||
var secureNoteData = JsonSerializer.Deserialize<CipherSecureNoteData>(cipher.Data);
|
||||
Data = secureNoteData;
|
||||
cipherData = secureNoteData;
|
||||
SecureNote = new CipherSecureNoteModel(secureNoteData);
|
||||
break;
|
||||
case CipherType.Card:
|
||||
var cardData = JsonConvert.DeserializeObject<CipherCardData>(cipher.Data);
|
||||
var cardData = JsonSerializer.Deserialize<CipherCardData>(cipher.Data);
|
||||
Data = cardData;
|
||||
cipherData = cardData;
|
||||
Card = new CipherCardModel(cardData);
|
||||
break;
|
||||
case CipherType.Identity:
|
||||
var identityData = JsonConvert.DeserializeObject<CipherIdentityData>(cipher.Data);
|
||||
var identityData = JsonSerializer.Deserialize<CipherIdentityData>(cipher.Data);
|
||||
Data = identityData;
|
||||
cipherData = identityData;
|
||||
Identity = new CipherIdentityModel(identityData);
|
||||
|
@ -1,10 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Api;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Bit.Api.Models.Response
|
||||
{
|
||||
@ -19,10 +19,10 @@ namespace Bit.Api.Models.Response
|
||||
}
|
||||
|
||||
EquivalentDomains = user.EquivalentDomains != null ?
|
||||
JsonConvert.DeserializeObject<List<List<string>>>(user.EquivalentDomains) : null;
|
||||
JsonSerializer.Deserialize<List<List<string>>>(user.EquivalentDomains) : null;
|
||||
|
||||
var excludedGlobalEquivalentDomains = user.ExcludedGlobalEquivalentDomains != null ?
|
||||
JsonConvert.DeserializeObject<List<GlobalEquivalentDomainsType>>(user.ExcludedGlobalEquivalentDomains) :
|
||||
JsonSerializer.Deserialize<List<GlobalEquivalentDomainsType>>(user.ExcludedGlobalEquivalentDomains) :
|
||||
new List<GlobalEquivalentDomainsType>();
|
||||
var globalDomains = new List<GlobalDomains>();
|
||||
var domainsToInclude = excluded ? Core.Utilities.StaticStore.GlobalDomains :
|
||||
|
@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Api;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Bit.Api.Models.Response
|
||||
{
|
||||
@ -23,7 +23,7 @@ namespace Bit.Api.Models.Response
|
||||
Enabled = policy.Enabled;
|
||||
if (!string.IsNullOrWhiteSpace(policy.Data))
|
||||
{
|
||||
Data = JsonConvert.DeserializeObject<Dictionary<string, object>>(policy.Data);
|
||||
Data = JsonSerializer.Deserialize<Dictionary<string, object>>(policy.Data);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
using System;
|
||||
using System.Text.Json;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Utilities;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Bit.Api.Models.Response
|
||||
{
|
||||
@ -26,12 +26,12 @@ namespace Bit.Api.Models.Response
|
||||
switch (send.Type)
|
||||
{
|
||||
case SendType.File:
|
||||
var fileData = JsonConvert.DeserializeObject<SendFileData>(send.Data);
|
||||
var fileData = JsonSerializer.Deserialize<SendFileData>(send.Data);
|
||||
sendData = fileData;
|
||||
File = new SendFileModel(fileData);
|
||||
break;
|
||||
case SendType.Text:
|
||||
var textData = JsonConvert.DeserializeObject<SendTextData>(send.Data);
|
||||
var textData = JsonSerializer.Deserialize<SendTextData>(send.Data);
|
||||
sendData = textData;
|
||||
Text = new SendTextModel(textData);
|
||||
break;
|
||||
|
@ -1,11 +1,11 @@
|
||||
using System;
|
||||
using System.Text.Json;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Api;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Settings;
|
||||
using Bit.Core.Utilities;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Bit.Api.Models.Response
|
||||
{
|
||||
@ -36,12 +36,12 @@ namespace Bit.Api.Models.Response
|
||||
switch (send.Type)
|
||||
{
|
||||
case SendType.File:
|
||||
var fileData = JsonConvert.DeserializeObject<SendFileData>(send.Data);
|
||||
var fileData = JsonSerializer.Deserialize<SendFileData>(send.Data);
|
||||
sendData = fileData;
|
||||
File = new SendFileModel(fileData);
|
||||
break;
|
||||
case SendType.Text:
|
||||
var textData = JsonConvert.DeserializeObject<SendTextData>(send.Data);
|
||||
var textData = JsonSerializer.Deserialize<SendTextData>(send.Data);
|
||||
sendData = textData;
|
||||
Text = new SendTextModel(textData);
|
||||
break;
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Bit.Core.Models.Data;
|
||||
using System.Text.Json.Serialization;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Api.Models
|
||||
@ -11,7 +12,7 @@ namespace Bit.Api.Models
|
||||
{
|
||||
Id = data.Id;
|
||||
FileName = data.FileName;
|
||||
Size = data.SizeString;
|
||||
Size = data.Size;
|
||||
SizeName = CoreHelpers.ReadableBytesSize(data.Size);
|
||||
}
|
||||
|
||||
@ -19,7 +20,8 @@ namespace Bit.Api.Models
|
||||
[EncryptedString]
|
||||
[EncryptedStringLength(1000)]
|
||||
public string FileName { get; set; }
|
||||
public string Size { get; set; }
|
||||
[JsonNumberHandling(JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)]
|
||||
public long Size { get; set; }
|
||||
public string SizeName { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Messaging.EventGrid;
|
||||
using Azure.Messaging.EventGrid.SystemEvents;
|
||||
using Bit.Core.Utilities;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Bit.Api.Utilities
|
||||
{
|
||||
@ -27,7 +27,7 @@ namespace Bit.Api.Utilities
|
||||
var s = await reader.ReadToEndAsync();
|
||||
if (!string.IsNullOrWhiteSpace(s))
|
||||
{
|
||||
obj = JsonConvert.DeserializeObject<T>(s);
|
||||
obj = JsonSerializer.Deserialize<T>(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Api.Models.Request;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@ -7,7 +8,6 @@ using Microsoft.AspNetCore.Http.Features;
|
||||
using Microsoft.AspNetCore.WebUtilities;
|
||||
using Microsoft.Extensions.Primitives;
|
||||
using Microsoft.Net.Http.Headers;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Bit.Api.Utilities
|
||||
{
|
||||
@ -78,13 +78,6 @@ namespace Bit.Api.Utilities
|
||||
{
|
||||
if (ContentDispositionHeaderValue.TryParse(firstSection.ContentDisposition, out _))
|
||||
{
|
||||
// Request model json, then data
|
||||
string requestModelJson = null;
|
||||
using (var sr = new StreamReader(firstSection.Body))
|
||||
{
|
||||
requestModelJson = await sr.ReadToEndAsync();
|
||||
}
|
||||
|
||||
var secondSection = await reader.ReadNextSectionAsync();
|
||||
if (secondSection != null)
|
||||
{
|
||||
@ -94,7 +87,7 @@ namespace Bit.Api.Utilities
|
||||
var fileName = HeaderUtilities.RemoveQuotes(secondContent.FileName).ToString();
|
||||
using (secondSection.Body)
|
||||
{
|
||||
var model = JsonConvert.DeserializeObject<SendRequestModel>(requestModelJson);
|
||||
var model = await JsonSerializer.DeserializeAsync<SendRequestModel>(firstSection.Body);
|
||||
await callback(secondSection.Body, fileName, model);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user