2
0
mirror of https://github.com/9ParsonsB/Pulsar.git synced 2025-07-03 01:03:41 -04:00

feat: update check

This commit is contained in:
Xjph
2021-10-22 22:42:44 -02:30
parent b37f9fffd5
commit 908ea59b20
3 changed files with 130 additions and 6 deletions

View File

@ -0,0 +1,36 @@
using System;
using System.Net.Http;
namespace Observatory
{
public sealed class HttpClient
{
private HttpClient()
{ }
private static readonly Lazy<System.Net.Http.HttpClient> lazy = new Lazy<System.Net.Http.HttpClient>(() => new System.Net.Http.HttpClient());
public static System.Net.Http.HttpClient Client
{
get
{
return lazy.Value;
}
}
public static string GetString(string url)
{
return lazy.Value.GetStringAsync(url).Result;
}
public static HttpResponseMessage SendRequest(HttpRequestMessage request)
{
return lazy.Value.SendAsync(request).Result;
}
public static System.Threading.Tasks.Task<HttpResponseMessage> SendRequestAsync(HttpRequestMessage request)
{
return lazy.Value.SendAsync(request);
}
}
}