Catcher.AndroidDemo.Common.EasyWebRequest.SendPostRequestBasedOnHttpClient C# (CSharp) Method

SendPostRequestBasedOnHttpClient() public static method

send the post request based on HttpClient
public static SendPostRequestBasedOnHttpClient ( string requestUrl, string>.IDictionary routeParameters ) : Task
requestUrl string the url you post
routeParameters string>.IDictionary the parameters you post
return Task
        public static async Task<object> SendPostRequestBasedOnHttpClient(string requestUrl, IDictionary<string, string> routeParameters)
        {
            object returnValue = new object();
            HttpClient client = new HttpClient();
            client.MaxResponseContentBufferSize = 256000;
            Uri uri = new Uri(requestUrl);
            var content = new FormUrlEncodedContent(routeParameters);
            try
            {
                var response = await client.PostAsync(uri, content);
                if (response.IsSuccessStatusCode)
                {
                    var stringValue = await response.Content.ReadAsStringAsync();
                    returnValue = JsonObject.Parse(stringValue);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return returnValue;
        }