mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-02-01 23:59:12 +00:00
17 lines
481 B
C#
17 lines
481 B
C#
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();
|
|
}
|
|
}
|
|
} |