Exemple #1
0
        /// <summary>
        /// Makes PUT request to the specified URL.
        /// </summary>
        /// <param name="url"></param>
        /// <param name="body">PUT content.</param>
        /// <param name="contentType">Content type. Default is 'application/json'.</param>
        /// <returns></returns>
        public async Task <EasyHttpResponse> PutAsync(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.PutAsync(url, httpContent)));
        }