Esempio n. 1
0
        public HttpResponse ExtractResponse(WebResponse response, Encoding encoding)
        {
            string body;
            int    statusCode;
            IEnumerable <KeyValuePair <string, string> > headers;

            using (var webResponse = (HttpWebResponse)response)
            {
                statusCode = (int)webResponse.StatusCode;
                headers    = ExtractHeaderFrom(webResponse);
                using (var reader = new StreamReader(webResponse.GetResponseStream(), encoding))
                {
                    body = reader.ReadToEnd();
                }
            }

            return(_httpResponseFactory.Create(statusCode, headers, body));
        }