public static async Task <T> SendPostRequest <T>(this L2Request req) where T : L2Response { var request = await new HttpClient().PostAsync(Startup.Configuration.GetValue <string>("ApiEndpoint"), new JsonContent(req)); var result = AesCrypto.DecryptRijndael(await request.Content.ReadAsStringAsync(), Startup.Configuration.GetValue <string>("CryptoSalt")); var responseObject = JsonConvert.DeserializeObject <T>(result); return(responseObject); }
public static async Task <T> SendPostRequest <T>(this L2Request req) where T : L2Response { var request = await new HttpClient().PostAsync(ApiUrl, new JsonContent(req)); var result = AesCrypto.DecryptRijndael(await request.Content.ReadAsStringAsync(), Constants.Salt); var responseObject = JsonConvert.DeserializeObject <T>(result); return(responseObject); }