diff --git a/README.md b/README.md index 80eaf7b..a43724c 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ var modem1 = new Modem({socketPath: '/var/run/docker.sock'}); var modem2 = new Modem(); //defaults to above if env variables are not used var modem3 = new Modem({host: 'http://192.168.1.10', port: 3000}); var modem4 = new Modem({protocol:'http', host: '127.0.0.1', port: 3000}); -var modem5 = new Modem({host: '127.0.0.1', port: 3000}); / +var modem5 = new Modem({host: '127.0.0.1', port: 3000}); //defaults to http ``` ### SSH @@ -36,7 +36,7 @@ var modem1 = new Modem({ //custom agent var customAgent = myOwnSSHAgent({host: 'ssh://127.0.0.1', port: 22}); -var modem1 = new Modem({ +var modem2 = new Modem({ agent: customAgent, }); ``` diff --git a/lib/modem.js b/lib/modem.js index bc46636..012ddd4 100644 --- a/lib/modem.js +++ b/lib/modem.js @@ -231,7 +231,7 @@ Modem.prototype.buildRequest = function(options, context, data, callback) { debug('Received: %s', result); - var json = utils.parseJSON(result) || result; + var json = utils.parseJSON(result) || buffer; self.buildPayload(null, context.isStream, context.statusCodes, false, req, res, json, callback); }); } diff --git a/test/modem_test.js b/test/modem_test.js index 506512a..a687d14 100644 --- a/test/modem_test.js +++ b/test/modem_test.js @@ -132,6 +132,4 @@ describe('Modem', function() { assert.ok(modem.agent instanceof http.Agent); assert.strictEqual(modem.agent, httpAgent); }); - - });