mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-02-18 15:36:29 +00:00
Rework architecture
This commit is contained in:
17
DiscordChatExporter.Domain/Internal/HttpClientExtensions.cs
Normal file
17
DiscordChatExporter.Domain/Internal/HttpClientExtensions.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Net.Http;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DiscordChatExporter.Domain.Internal
|
||||
{
|
||||
internal static class HttpClientExtensions
|
||||
{
|
||||
public static async Task<JsonElement> ReadAsJsonAsync(this HttpContent content)
|
||||
{
|
||||
await using var stream = await content.ReadAsStreamAsync();
|
||||
using var doc = await JsonDocument.ParseAsync(stream);
|
||||
|
||||
return doc.RootElement.Clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user