//line by line
var serializer = new JsonSerializer();
- var hashes=(List<string>)serializer.Deserialize(reader, typeof (List<string>));
-
- return hashes;
+ serializer.Error += (sender, args) => Log.ErrorFormat("Deserialization error at [{0}] [{1}]", args.ErrorContext.Error, args.ErrorContext.Member);
+ if (Log.IsDebugEnabled)
+ {
+ var body=reader.ReadToEnd();
+ Log.DebugFormat("JSON response: {0}",body);
+ using (var strReader = new StringReader(body))
+ {
+ var hashes = (List<string>)serializer.Deserialize(strReader, typeof(List<string>));
+ return hashes;
+ }
+ }
+ else
+ {
+ var hashes = (List<string>)serializer.Deserialize(reader, typeof(List<string>));
+ return hashes;
+ }
}
}
//Any other status code is unexpected and the exception should be rethrown