Skip to content

Commit

Permalink
Revert "Fix request timeout no working"
Browse files Browse the repository at this point in the history
  • Loading branch information
ianwsperber committed Feb 28, 2017
1 parent 3728a1f commit 0a083f6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -3,4 +3,3 @@ npm-debug.log
coverage
.nyc_output/
tests/browserify-public/browserify-bundle.js
.vscode/
6 changes: 2 additions & 4 deletions lib/request_overrider.js
Expand Up @@ -133,7 +133,6 @@ function RequestOverrider(req, options, interceptors, remove, cb) {
};

req.socket = response.socket = Socket({ proto: options.proto });
req.socket.connecting = true;

req.write = function(buffer, encoding) {
debug('write', arguments);
Expand Down Expand Up @@ -195,6 +194,8 @@ function RequestOverrider(req, options, interceptors, remove, cb) {
// emit a fake socket.
if (event == 'socket') {
listener.call(req, req.socket);
req.socket.emit('connect', req.socket);
req.socket.emit('secureConnect', req.socket);
}

EventEmitter.prototype.on.call(this, event, listener);
Expand Down Expand Up @@ -490,9 +491,6 @@ function RequestOverrider(req, options, interceptors, remove, cb) {

debug('emitting response');

req.socket.emit('connect', req.socket);
req.socket.emit('secureConnect', req.socket);

if (typeof cb === 'function') {
debug('callback with response');
cb(response);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -191,7 +191,7 @@
"node-static": "^0.7.7",
"nyc": "^10.0.0",
"pre-commit": "1.1.2",
"request": "2.79.0",
"request": "2.71.0",
"request-promise": "^2.0.1",
"restify": "^4.0.4",
"restler": "3.4.0",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_intercept.js
Expand Up @@ -4234,12 +4234,12 @@ test('socket emits connect and secureConnect', function(t) {

req.on('socket', function(socket) {
socket.once('connect', function() {
req.end();
t.ok(true);
});
socket.once('secureConnect', function() {
t.ok(true);
});
req.end();
});

req.once('response', function(res) {
Expand Down

0 comments on commit 0a083f6

Please sign in to comment.