lib/request.js
function request(url, options, callback)
{
  var connection;

  if (typeof options == 'function')
  {
    callback = options;
    options  = {};
  }

  connection = hyperquest(url, options, once(function(error, response)
  {
    if (error)
    {
      callback(error, response);
      return;
    }

    // set body
    response.body = '';

    // accumulate response body
    response.on('data', function(data)
    {
      response.body += data.toString();
    });

    response.on('end', function()
    {
      callback(null, response);
    });
  }));

  return connection;
}
function request(url, options, callback)
{
  var connection;

  if (typeof options == 'function')
  {
    callback = options;
    options  = {};
  }

  connection = hyperquest(url, options, once(function(error, response)
  {
    if (error)
    {
      callback(error, response);
      return;
    }

    // set body
    response.body = '';

    // accumulate response body
    response.on('data', function(data)
    {
      response.body += data.toString();
    });

    response.on('end', function()
    {
      callback(null, response);
    });
  }));

  return connection;
}
function request ( url , options , callback ) { var connection ; if ( typeof options == 'function' ) { callback = options ; options = { } ; } connection = hyperquest ( url , options , once ( function ( error , response ) { if ( error ) { callback ( error , response ) ; return ; } // set body response . body = '' ; // accumulate response body response . on ( 'data' , function ( data ) { response . body += data . toString ( ) ; } ) ; response . on ( 'end' , function ( ) { callback ( null , response ) ; } ) ; } ) ) ; return connection ; }
Wraps hyperquest to provide extra convenience
with handling responses

@param   {string} url - url to request
@param   {object} [options] - request options
@param   {function} callback - invoked on response
@returns {stream.Duplex} - request stream
Wraps hyperquest to provide extra convenience with handling responses