Skip to content

Commit

Permalink
fix(collector): set explicit content-length
Browse files Browse the repository at this point in the history
  • Loading branch information
gergelyke committed Sep 13, 2015
1 parent ade9290 commit 5260fc6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/reporters/trace.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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) {

Expand Down Expand Up @@ -131,9 +136,7 @@ TraceReporter.prototype.getService = function(callback) {
}));
});

req.write(JSON.stringify({
name: _this.appName
}));
req.write(payload);
req.end();
};

Expand Down

0 comments on commit 5260fc6

Please sign in to comment.