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); }
private void LogException(string callingFunction, Exception ex) { RestLogger.Log("RestServer::" + callingFunction, ex); }