From 4e47700c71368845d944fb1d4d1f659b97d91cff Mon Sep 17 00:00:00 2001 From: Nicolas Gotchac Date: Tue, 16 May 2017 17:33:58 +0200 Subject: [PATCH] Fix ping when no Success --- src/api/ping.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/api/ping.js b/src/api/ping.js index eeaa3125a..be49bb37f 100644 --- a/src/api/ping.js +++ b/src/api/ping.js @@ -21,10 +21,14 @@ module.exports = (send) => { // go-ipfs http api currently returns 3 lines for a ping. // they're a little messed, so take the correct values from each lines. + const Success = res[1].Success + const Time = res[1].Time + const Text = res.length > 2 ? res[2].Text : res[1].Text + const pingResult = { - Success: res[1].Success, - Time: res[1].Time, - Text: res[2].Text + Success: Success, + Time: Time, + Text: Text } callback(null, pingResult)