Use a stream instead of putting the entire string in memory

This commit is contained in:
Jeff Leung 2024-02-27 15:30:13 -08:00
parent af3cc81180
commit 5f089fb01f
1 changed files with 2 additions and 2 deletions

View File

@ -52,7 +52,7 @@ namespace AS1024.GeoFeed.Core.GeoFeedProviders
{
break;
}
string stringResult = await result.Content.ReadAsStringAsync();
var stringResult = await result.Content.ReadAsStreamAsync();
jsonData = DeserializeJsonData(stringResult);
if (jsonData?.Results == null || jsonData.Results.Count == 0)
@ -93,7 +93,7 @@ namespace AS1024.GeoFeed.Core.GeoFeedProviders
return geoFeed;
}
protected virtual NetboxData? DeserializeJsonData(string stringResult)
protected virtual NetboxData? DeserializeJsonData(Stream stringResult)
{
return JsonSerializer.Deserialize<NetboxData>(stringResult, new JsonSerializerOptions
{