Mark samples as AOT compatible (#184)
* 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>
This commit is contained in:
parent
c452dc8e26
commit
f652b1a03d
1 changed files with 51 additions and 10 deletions
13
samples/QuickstartWeatherServer/Tools/HttpClientExt.cs
Normal file
13
samples/QuickstartWeatherServer/Tools/HttpClientExt.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
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());
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue