fix: build and lots of obsolete warnings

This commit is contained in:
Andriy
2025-02-09 17:40:03 +02:00
parent 8917a8ba5f
commit c3a553f68d
29 changed files with 103 additions and 108 deletions
+5 -5
View File
@@ -1,21 +1,21 @@
using System;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace Kruzya.TelegramBot.Core.Extensions;
public static class HttpClientExtension
{
public static async Task<T> GetJsonAsync<T>(this HttpClient client, Uri requestUri)
public static async Task<T?> GetJsonAsync<T>(this HttpClient client, Uri requestUri)
{
var response = await client.GetStringAsync(requestUri);
return JsonConvert.DeserializeObject<T>(response);
return JsonSerializer.Deserialize<T>(response);
}
public static async Task<T> GetJsonAsync<T>(this HttpClient client, string requestUri)
public static async Task<T?> GetJsonAsync<T>(this HttpClient client, string requestUri)
{
var response = await client.GetStringAsync(requestUri);
return JsonConvert.DeserializeObject<T>(response);
return JsonSerializer.Deserialize<T>(response);
}
}