Пример #1
0
        async Task <HttpResponseMessage> IHttpClientWrapper.PostJson <T>(RequestOptions options, T content)
        {
            // Initialize request
            Uri url     = new Uri(this._baseUri, options.PathAndQuery);
            var request = new HttpRequestMessage(HttpMethod.Post, url);

            this.SetXApiVersionHeader(request);
            await this.SetAuthorizationHeader(request);

            this.SetCustomHeaders(request, options);
            request.Content = new ObjectContent <T>(content, options.GetFormatter());

            // Perform request
            HttpResponseMessage response = await this._httpClient.SendAsync(request);

            this.EnsureResponseIsValid(response);

            return(response);
        }