private object ProcessResponse(Stream responseStream)
{
if (_service == RestService.Binary) {
return responseStream;
}
dynamic result = null;
try {
string responseText = (new StreamReader(responseStream)).ReadToEnd();
if (_service == RestService.Json) {
JsonReader jsonReader = new JsonReader(responseText);
result = jsonReader.ReadValue();
}
else {
responseText = StripXmlnsRegex.Replace(responseText, String.Empty);
XDocument xmlDocument = XDocument.Parse(responseText);
result = new XmlNode(xmlDocument.Root);
}
}
catch {
}
return result;
}