コード例 #1
0
        public static async Task <HttpResponseMessage> DeleteAsync(this HttpClient httpClient, string url, CancellationToken cancellationToken,
                                                                   QueryString queryString = null, IDictionary <string, string> headers = null)
        {
            var request = httpClient.CreateRequest(HttpMethod.Delete, url, queryString, headers);

            return(await httpClient.SendAsync(request, cancellationToken));
        }
コード例 #2
0
        public static async Task <HttpResponseMessage> GetAsync(this HttpClient httpClient, string url,
                                                                QueryString queryString = null, IDictionary <string, string> headers = null)
        {
            var request = httpClient.CreateRequest(HttpMethod.Get, url, queryString, headers);

            return(await httpClient.SendAsync(request));
        }
コード例 #3
0
        public static async Task<HttpResponseMessage> DeleteAsync<T>(this HttpClient httpClient, string url, T body, CancellationToken cancellationToken,
            QueryString queryString = null, IDictionary<string, string> headers = null) where T : class
        {
            var request = httpClient.CreateRequest(HttpMethod.Delete, url, queryString, headers);
            request.Content = CreateContent(body);

            return await httpClient.SendAsync(request, cancellationToken);
        }
コード例 #4
0
        public static async Task <HttpResponseMessage> PutAsync <T>(this HttpClient httpClient, string url, T body,
                                                                    QueryString queryString = null, IDictionary <string, string> headers = null) where T : class
        {
            var request = httpClient.CreateRequest(HttpMethod.Put, url, queryString, headers);

            request.Content = CreateContent(body);

            return(await httpClient.SendAsync(request));
        }