Exemple #1
0
        /// <summary>
        /// Makes POST request to the specified URL.
        /// </summary>
        /// <param name="url"></param>
        /// <param name="body">POST content.</param>
        /// <param name="contentType">Content type. Default is 'application/json'.</param>
        /// <returns></returns>
        public async Task <EasyHttpResponse> PostAsync(string url, string body, string contentType = null)
        {
            if (string.IsNullOrWhiteSpace(contentType))
            {
                contentType = "application/json";
            }

            HttpContent httpContent = new StringContent(body);

            httpContent.Headers.Clear();
            httpContent.Headers.Add("content-type", contentType);

            return(new EasyHttpResponse(await EasyClient.PostAsync(url, httpContent)));
        }