using System; using System.Net.Http; namespace Observatory.Utils { public sealed class HttpClient { private HttpClient() { } private static readonly Lazy lazy = new Lazy(() => 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 Task SendRequestAsync(HttpRequestMessage request) { return lazy.Value.SendAsync(request); } } }