index.js
function _proxy(rule, metas) {
  var opts = _getRequestOpts(metas.req, rule);
  var request = httpsSyntax.test(rule.replace) ? httpsReq : httpReq;

  var pipe = request(opts, function (res) {
    res.headers.via = opts.headers.via;
    metas.res.writeHead(res.statusCode, res.headers);
    res.on('error', function (err) {
      metas.next(err);
    });
    res.pipe(metas.res);
  });

  pipe.on('error', function (err) {
    metas.next(err);
  });

  if(!metas.req.readable) {
    pipe.end();
  } else {
    metas.req.pipe(pipe);
  }
}
function _proxy(rule, metas) {
  var opts = _getRequestOpts(metas.req, rule);
  var request = httpsSyntax.test(rule.replace) ? httpsReq : httpReq;

  var pipe = request(opts, function (res) {
    res.headers.via = opts.headers.via;
    metas.res.writeHead(res.statusCode, res.headers);
    res.on('error', function (err) {
      metas.next(err);
    });
    res.pipe(metas.res);
  });

  pipe.on('error', function (err) {
    metas.next(err);
  });

  if(!metas.req.readable) {
    pipe.end();
  } else {
    metas.req.pipe(pipe);
  }
}
function _proxy ( rule , metas ) { var opts = _getRequestOpts ( metas . req , rule ) ; var request = httpsSyntax . test ( rule . replace ) ? httpsReq : httpReq ; var pipe = request ( opts , function ( res ) { res . headers . via = opts . headers . via ; metas . res . writeHead ( res . statusCode , res . headers ) ; res . on ( 'error' , function ( err ) { metas . next ( err ) ; } ) ; res . pipe ( metas . res ) ; } ) ; pipe . on ( 'error' , function ( err ) { metas . next ( err ) ; } ) ; if ( ! metas . req . readable ) { pipe . end ( ) ; } else { metas . req . pipe ( pipe ) ; } }
Proxy the request

@param {Object} rule
@param {Object} metas
@return {void}
@api private
Proxy the request