Add netstandard2.0 support (#33)

* Add netstandard2.0 support
This commit is contained in:
Stephen Toub 2025-03-07 14:46:40 -05:00 • committed by GitHub
commit 9c597aad90
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -0,0 +1,26 @@
namespace System.Net.Http;
internal static class HttpClientExtensions
{
public static async Task<Stream> ReadAsStreamAsync(this HttpContent content, CancellationToken cancellationToken)
{
if (content is null)
{
throw new ArgumentNullException(nameof(content));
}
cancellationToken.ThrowIfCancellationRequested();
return await content.ReadAsStreamAsync();
}
public static async Task<string> ReadAsStringAsync(this HttpContent content, CancellationToken cancellationToken)
{
if (content is null)
{
throw new ArgumentNullException(nameof(content));
}
cancellationToken.ThrowIfCancellationRequested();
return await content.ReadAsStringAsync();
}
}