DynamicRest.ResponseProcessor.Process C# (CSharp) Method

Process() public method

public Process ( IHttpResponse webResponse, RestOperation operation ) : void
webResponse IHttpResponse
operation RestOperation
return void
        public void Process(IHttpResponse webResponse, RestOperation operation)
        {
            try
            {
                var responseStream = webResponse.GetResponseStream();
                if (_builder.ServiceType == RestService.Binary)
                {
                    ProcessResponseStream(webResponse, responseStream, operation);
                }
                else
                {
                    using (responseStream)
                    {
                        if (IsGzippedReponse(webResponse.Headers["Content-Encoding"]))
                        {
                            using (var gzipResponseStream = new GZipStream(responseStream, CompressionMode.Decompress))
                            {
                                ProcessResponseStream(webResponse, gzipResponseStream, operation);
                            }
                        }
                        else
                        {
                            ProcessResponseStream(webResponse, responseStream, operation);
                        }
                    }
                }
            }
            catch(Exception e)
            {
                operation.Complete(null, new WebException(e.Message, e),
                    webResponse.StatusCode, webResponse.StatusDescription, webResponse.Headers, null);
            }
        }