From 5260fc667884a20e620cc70fc556483cfc9f238c Mon Sep 17 00:00:00 2001 From: Gergely Nemeth Date: Sun, 13 Sep 2015 07:41:55 +0200 Subject: [PATCH] fix(collector): set explicit content-length --- lib/reporters/trace.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/reporters/trace.js b/lib/reporters/trace.js index b85e0d6..d395f1e 100644 --- a/lib/reporters/trace.js +++ b/lib/reporters/trace.js @@ -87,6 +87,10 @@ TraceReporter.prototype.getService = function(callback) { var opts = url.parse(COLLECTOR_API_SERVICE); var _this = this; + var payload = JSON.stringify({ + name: _this.appName + }); + var req = https.request({ hostname: opts.hostname, port: opts.port, @@ -95,7 +99,8 @@ TraceReporter.prototype.getService = function(callback) { headers: { 'Authorization': 'Bearer ' + this.apiKey, 'Content-Type': 'application/json', - 'X-Reporter-Version': package.version + 'X-Reporter-Version': package.version, + 'Content-Length': payload.length } }, function (res) { @@ -131,9 +136,7 @@ TraceReporter.prototype.getService = function(callback) { })); }); - req.write(JSON.stringify({ - name: _this.appName - })); + req.write(payload); req.end(); };