Skip to content

Commit

Permalink
Merge pull request #289 from saschagoebel/master
Browse files Browse the repository at this point in the history
Always send Content-Length header. Fixes compatibility issues with el…
  • Loading branch information
spalger committed Nov 30, 2015
2 parents c8d5bae + 48667b2 commit bf8ef6e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/lib/connectors/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,11 @@ HttpConnector.prototype.request = function (params, cb) {
request.setHeader('Content-Length', Buffer.byteLength(params.body, 'utf8'));
request.end(params.body);
} else {
request.setHeader('Content-Length', 0);
request.end();
}

return function () {
request.abort();
};
};
};
3 changes: 2 additions & 1 deletion test/mocks/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ var http = require('http');
function MockRequest() {
sinon.stub(this, 'end');
sinon.stub(this, 'write');
sinon.stub(this, 'setHeader');
this.log = sinon.stub(this.log);
}
util.inherits(MockRequest, http.ClientRequest);
util.inherits(MockRequest, http.ClientRequest);

0 comments on commit bf8ef6e

Please sign in to comment.