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());
|
|
}
|
|
} |