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);
}
}