示例#1
0
        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);
        }
示例#2
0
        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);
        }