From 6449819f7a906f09d6b6fd4d9beb8273720f1644 Mon Sep 17 00:00:00 2001 From: Mangin Alexander Date: Mon, 27 Jun 2016 21:35:13 +0500 Subject: [PATCH] allow a multi param response --- lib/deserializer.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/deserializer.js b/lib/deserializer.js index 819356a..dce6ddc 100644 --- a/lib/deserializer.js +++ b/lib/deserializer.js @@ -29,9 +29,6 @@ Deserializer.prototype.deserializeMethodResponse = function(stream, callback) { if (error) { callback(error) } - else if (result.length > 1) { - callback(new Error('Response has more than one param')) - } else if (that.type !== 'methodresponse') { callback(new Error('Not a method response')) } @@ -39,7 +36,7 @@ Deserializer.prototype.deserializeMethodResponse = function(stream, callback) { callback(new Error('Invalid method response')) } else { - callback(null, result[0]) + callback(null, result.length === 1 ? result[0] : result) } } @@ -96,13 +93,13 @@ Deserializer.prototype.onDone = function() { // TODO: // Error handling needs a little thinking. There are two different kinds of -// errors: +// errors: // 1. Low level errors like network, stream or xml errors. These don't // require special treatment. They only need to be forwarded. The IO -// is already stopped in these cases. +// is already stopped in these cases. // 2. Protocol errors: Invalid tags, invalid values &c. These happen in // our code and we should tear down the IO and stop parsing. -// Currently all errors end here. Guess I'll split it up. +// Currently all errors end here. Guess I'll split it up. Deserializer.prototype.onError = function(msg) { if (!this.error) { if (typeof msg === 'string') {