This commit is contained in:
CortexCore
2023-10-02 23:24:56 +08:00
parent 8ef5c7ec0a
commit 947e52e748
183 changed files with 107857 additions and 9378 deletions

View File

@@ -0,0 +1,19 @@
using System.Net.Http;
using System.Text;
using System.Threading;
using Cysharp.Threading.Tasks;
using Newtonsoft.Json;
namespace BITKit
{
public static class HttpClientExtensions
{
public static async UniTask<string> PostJsonAsync(this HttpClient self, string requestUrl, object value , CancellationToken cancellationToken=default)
{
var json = JsonConvert.SerializeObject(value);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response =await self.PostAsync(requestUrl, content, cancellationToken);
return await response.Content.ReadAsStringAsync();
}
}
}