using System.Collections.Generic; using System.Net.Http; using System.Threading.Tasks; using BlueWest.Core.Tests; namespace BlueWest.DataAgent { public static class AgentHttp { private static readonly HttpClient Client = new HttpClient(); public static async Task PostAsync(string uri, object data) { var values = data.ToDictionary(); ByteArrayContent content = new FormUrlEncodedContent((IEnumerable>) values); var response = await Client.PostAsync(uri, content); var responseString = await response.Content.ReadAsStringAsync(); return responseString; } public static async Task GetAsync(string uri) { var responseString = await Client.GetStringAsync(uri); return responseString; } } }