middleware/bodyReader.js
function urlEncoded(gw, callback){
  var buffer = '';
  var readlength = 0;
  var $error = false;
  gw.req.on('data', function (chunk) {
    if (readlength > gw.content.length) {$error = true;}
    if (!$error) {
      readlength += chunk.length;
      buffer += chunk.toString('ascii');
    }
  });
  gw.req.on('end', function () {
    if ($error) {
      gw.error(400);
    } else {
      var params = gw.constructor.queryHeap(querystring.parse(buffer, '&', '='));
      gw.content.params = params;
      for(var i=0,k=Object.keys(params),l=k.length;i<l;i++){
        gw.params[k[i]]=params[k[i]];
      }
      callback();
    }
  });
}
function urlEncoded(gw, callback){
  var buffer = '';
  var readlength = 0;
  var $error = false;
  gw.req.on('data', function (chunk) {
    if (readlength > gw.content.length) {$error = true;}
    if (!$error) {
      readlength += chunk.length;
      buffer += chunk.toString('ascii');
    }
  });
  gw.req.on('end', function () {
    if ($error) {
      gw.error(400);
    } else {
      var params = gw.constructor.queryHeap(querystring.parse(buffer, '&', '='));
      gw.content.params = params;
      for(var i=0,k=Object.keys(params),l=k.length;i<l;i++){
        gw.params[k[i]]=params[k[i]];
      }
      callback();
    }
  });
}
function urlEncoded ( gw , callback ) { var buffer = '' ; var readlength = 0 ; var $error = false ; gw . req . on ( 'data' , function ( chunk ) { if ( readlength > gw . content . length ) { $error = true ; } if ( ! $error ) { readlength += chunk . length ; buffer += chunk . toString ( 'ascii' ) ; } } ) ; gw . req . on ( 'end' , function ( ) { if ( $error ) { gw . error ( 400 ) ; } else { var params = gw . constructor . queryHeap ( querystring . parse ( buffer , '&' , '=' ) ) ; gw . content . params = params ; for ( var i = 0 , k = Object . keys ( params ) , l = k . length ; i < l ; i ++ ) { gw . params [ k [ i ] ] = params [ k [ i ] ] ; } callback ( ) ; } } ) ; }
url-enconded parser.
url - enconded parser .