From bb56af5a883164980527d43c44c604e11830d11f Mon Sep 17 00:00:00 2001 From: "Marshall T. Rose" Date: Tue, 20 Dec 2016 15:10:47 -0800 Subject: [PATCH] If "rawP" option is passed to internal request.request... MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …don’t try to parse JSON — this is the cause of the mysterious “ledger-geoip warning: {}” messages! --- app/ledger.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/ledger.js b/app/ledger.js index 12cda47af5f..41af45f3c75 100644 --- a/app/ledger.js +++ b/app/ledger.js @@ -1127,6 +1127,7 @@ var roundtrip = (params, options, callback) => { var parts = typeof params.server === 'string' ? url.parse(params.server) : typeof params.server !== 'undefined' ? params.server : typeof options.server === 'string' ? url.parse(options.server) : options.server + var rawP = options.rawP if (!params.method) params.method = 'GET' parts = underscore.extend(underscore.pick(parts, [ 'protocol', 'hostname', 'port' ]), @@ -1170,7 +1171,7 @@ var roundtrip = (params, options, callback) => { } try { - payload = (response.statusCode !== 204) ? JSON.parse(body) : null + payload = rawP ? body : (response.statusCode !== 204) ? JSON.parse(body) : null } catch (err) { return callback(err) }