Ejemplo n.º 1
0
 private string GetContent(HttpWebResponse httpResponse)
 {
     try
     {
         using (Stream stream = httpResponse.GetResponseStream())
         {
             Stream dataStream = stream;
             if (httpResponse.Headers.AllKeys.Contains("Content-Encoding") &&
                 httpResponse.Headers["Content-Encoding"].Contains("gzip"))
             {
                 dataStream = new GZipStream(stream, CompressionMode.Decompress);
             }
             using (StreamReader reader = new StreamReader(dataStream))
             {
                 string content = reader.ReadToEnd();
                 return(content);
             }
         }
     }
     catch (Exception ex)
     {
         RestLogger.Log("Response::GetContent", ex);
     }
     return(string.Empty);
 }
Ejemplo n.º 2
0
 private void LogException(string callingFunction, Exception ex)
 {
     RestLogger.Log("RestServer::" + callingFunction, ex);
 }