2
0
mirror of https://github.com/9ParsonsB/Pulsar.git synced 2025-04-05 17:39:39 -04:00
pulsar/Pulsar/Utils/HttpClient.cs
Ben Parsons 256ebb179e Rework Journal File Reading
Remove Explorer
Remove Plugin Architecture
2024-04-14 21:52:11 +10:00

26 lines
716 B
C#

namespace Pulsar.Utils;
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 => 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 Task<HttpResponseMessage> SendRequestAsync(HttpRequestMessage request)
{
return lazy.Value.SendAsync(request);
}
}