Address some static analysis and TODOs (#12)

This commit is contained in:
Stephen Toub 2025-03-20 23:09:38 -04:00 • committed by GitHub
commit 33b9582199
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,13 +1,12 @@
using ModelContextProtocol.Utils;
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));
}
Throw.IfNull(content);
cancellationToken.ThrowIfCancellationRequested();
return await content.ReadAsStreamAsync();
@ -15,10 +14,7 @@ internal static class HttpClientExtensions
public static async Task<string> ReadAsStringAsync(this HttpContent content, CancellationToken cancellationToken)
{
if (content is null)
{
throw new ArgumentNullException(nameof(content));
}
Throw.IfNull(content);
cancellationToken.ThrowIfCancellationRequested();
return await content.ReadAsStringAsync();