diff --git a/lib/helpers.js b/lib/helpers.js index e2de7847f..fa5712ffb 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -4,7 +4,7 @@ var extend = require('util')._extend , jsonSafeStringify = require('json-stringify-safe') , crypto = require('crypto') -function detachMethod() { +function deferMethod() { if(typeof setImmediate === 'undefined') { return process.nextTick } @@ -86,4 +86,4 @@ exports.safeStringify = safeStringify exports.md5 = md5 exports.isReadStream = isReadStream exports.toBase64 = toBase64 -exports.detach = detachMethod() +exports.defer = deferMethod() diff --git a/request.js b/request.js index f72fdf165..48e8044b6 100644 --- a/request.js +++ b/request.js @@ -14,7 +14,7 @@ var optional = require('./lib/optional') , md5 = helpers.md5 , isReadStream = helpers.isReadStream , toBase64 = helpers.toBase64 - , detach = helpers.detach + , defer = helpers.defer , bl = require('bl') , oauth = optional('oauth-sign') , hawk = optional('hawk') @@ -655,7 +655,7 @@ Request.prototype.init = function (options) { // }) }) - detach(function () { + defer(function () { if (self._aborted) { return } @@ -762,7 +762,7 @@ Request.prototype.init = function (options) { } function wait_for_socket_response(){ - detach(function(){ + defer(function(){ // counter to prevent infinite blocking waiting for an open socket to be found. response_counter++ var trying = false