Repository: cordova-app-harness
Updated Branches:
  refs/heads/master 6548126a0 -> de2743ec8


harness-push: Print response body of non 200 responses


Project: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/cordova-app-harness/commit/68e7118a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/tree/68e7118a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/diff/68e7118a

Branch: refs/heads/master
Commit: 68e7118ab32d4029e5981090d0056195e43d5888
Parents: 6548126
Author: Andrew Grieve <[email protected]>
Authored: Mon May 26 15:00:28 2014 -0400
Committer: Andrew Grieve <[email protected]>
Committed: Mon May 26 15:00:28 2014 -0400

----------------------------------------------------------------------
 .../node_modules/cordova-harness-client/harnessclient.js    | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/68e7118a/harness-push/node_modules/cordova-harness-client/harnessclient.js
----------------------------------------------------------------------
diff --git a/harness-push/node_modules/cordova-harness-client/harnessclient.js 
b/harness-push/node_modules/cordova-harness-client/harnessclient.js
index 8f3677a..58ab5a7 100644
--- a/harness-push/node_modules/cordova-harness-client/harnessclient.js
+++ b/harness-push/node_modules/cordova-harness-client/harnessclient.js
@@ -93,11 +93,6 @@ function doRequest(method, target, action, options) {
 
     req.on('response', function(res) {
         process.stdout.write(' ==> ' + res.statusCode);
-        if (res.statusCode != 200) {
-            deferred.reject(new Error('Server returned status code: ' + 
res.statusCode));
-            res.destroy();
-            return;
-        }
         res.setEncoding('utf8');
         var body = '';
         res.on('data', function(chunk) {
@@ -105,6 +100,10 @@ function doRequest(method, target, action, options) {
         });
         res.on('end', function() {
             process.stdout.write(' (' + (new Date() - startTime) + ')\n');
+            if (res.statusCode != 200) {
+                deferred.reject(new Error('Server returned status code: ' + 
res.statusCode + '\n\n' + body));
+                return;
+            }
             try {
                 body = options.expectJson ? JSON.parse(body) : body;
             } catch (e) {

Reply via email to