* Revert changes to remove APIs * Apply suggestions from code review Co-authored-by: Stephen Toub <stoub@microsoft.com> --------- Co-authored-by: Stephen Toub <stoub@microsoft.com>
13 lines
No EOL
415 B
C#
13 lines
No EOL
415 B
C#
using System.Text.Json;
|
|
|
|
namespace ModelContextProtocol;
|
|
|
|
internal static class HttpClientExt
|
|
{
|
|
public static async Task<JsonDocument> ReadJsonDocumentAsync(this HttpClient client, string requestUri)
|
|
{
|
|
using var response = await client.GetAsync(requestUri);
|
|
response.EnsureSuccessStatusCode();
|
|
return await JsonDocument.ParseAsync(await response.Content.ReadAsStreamAsync());
|
|
}
|
|
} |