lib/request.js
function promisedRequest(params, callback) {
  var deferred = Promise.defer();
  var req;
  var createRequest = function() {
    if (!req) {
      req = request(params, function(err, response) {
        if (err) {
          deferred.reject(err);
        } else {
          deferred.resolve(response);
        }
      });
    }
    return req;
  };
  return streamify(deferred.promise, createRequest).thenCall(callback);
}
function promisedRequest(params, callback) {
  var deferred = Promise.defer();
  var req;
  var createRequest = function() {
    if (!req) {
      req = request(params, function(err, response) {
        if (err) {
          deferred.reject(err);
        } else {
          deferred.resolve(response);
        }
      });
    }
    return req;
  };
  return streamify(deferred.promise, createRequest).thenCall(callback);
}
function promisedRequest ( params , callback ) { var deferred = Promise . defer ( ) ; var req ; var createRequest = function ( ) { if ( ! req ) { req = request ( params , function ( err , response ) { if ( err ) { deferred . reject ( err ) ; } else { deferred . resolve ( response ) ; } } ) ; } return req ; } ; return streamify ( deferred . promise , createRequest ) . thenCall ( callback ) ; }
HTTP request method, returns promise instead of stream
@private
HTTP request method returns promise instead of stream