Skip to content

Commit

Permalink
Second try
Browse files Browse the repository at this point in the history
while we're waiting on nodejs/node#493
  • Loading branch information
nylen committed May 13, 2015
1 parent 8bb8a48 commit 026e953
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
},
"main" : "index.js",
"devDependencies" : {
"detect-engine" : "~1.0.2",
"express" : "~4.8.6",
"mocha" : "~1.21.4",
"passport" : "~0.2.0",
Expand Down
8 changes: 4 additions & 4 deletions test/basic.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var lib = require('./lib'),
var engine = require('detect-engine'),
lib = require('./lib'),
mocha = require('mocha'),
request = require('request'),
should = require('should');
Expand All @@ -23,9 +24,8 @@ describe('request-debug', function() {
});

function maybeTransferEncodingChunked(obj) {
// io.js has major version >= 1
var isNode = process.versions.node.test(/^0\./);
if (isNode) {
if (engine == 'node') {
// Node sends 'Transfer-Encoding: chunked' here, io.js does not
obj['transfer-encoding'] = 'chunked';
}
return obj;
Expand Down
6 changes: 2 additions & 4 deletions test/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,8 @@ var fixHeader = {
return val.replace(/^application\/x-www-form-urlencoded(; charset=utf-8)?$/, '<application/x-www-form-urlencoded>');
},
'content-length' : function(val, obj) {
// io.js has major version >= 1
var isNode = process.versions.node.test(/^0\./);
if (!isNode && obj.statusCode == 401) {
// io.js sends content-length here, Node.js does not
if (engine == 'iojs' && obj.statusCode == 401) {
// io.js sends content-length here, Node does not
return null;
}
}
Expand Down

0 comments on commit 026e953

Please sign in to comment.