Exemplo n.º 1
0
        public async Task <IHttpResponse <TResult> > HttpResponseAsync <TResult>(HttpRequestContent <object> payload)
        {
            await _httpRequest.ExecuteAsync(payload);

            var response = await _httpResponse.ExecuteAsync <TResult>();

            _httpRequest.Dispose();
            return(response);
        }
Exemplo n.º 2
0
        public async Task <HttpWebResponse> ExecuteAsync(HttpRequestContent <object> payload)
        {
            await _httpRequest.ExecuteAsync(payload);

            var httpResponse = await _httpResponse.ExecuteAsync();

            _httpRequest.Dispose();
            return(httpResponse);
        }
        public override async Task <HttpWebRequest> ExecuteAsync(HttpRequestContent <object> payload)
        {
            using (var streamWriter = await HttpWebRequest.GetRequestStreamAsync())
            {
                IHttpRequestContent httpContent = delegateHttpRequest[HttpWebRequest.ContentType](payload.Content);

                HttpWebRequest.ContentType = httpContent.Headers.ContentType.ToString();
                httpContent.AddFiles(payload.Files);
                await httpContent.CopyToAsync(streamWriter);

                httpContent.Dispose();
                streamWriter.Close();
            }

            return(HttpWebRequest);
        }