
/*!
 * Connect - query
 * Copyright(c) 2011 TJ Holowaychuk
 * Copyright(c) 2011 Sencha Inc.
 * MIT Licensed
 */

/**
 * Module dependencies.
 */

var qs = require('qs')
  , parse = require('url').parse;

/**
 * Automatically parse the query-string when available,
 * populating the `req.query` object.
 *
 * Examples:
 *
 *     connect(
 *         connect.query()
 *       , function(req, res){
 *         res.end(JSON.stringify(req.query));
 *       }
 *     ).listen(3000);
 *
 * @return {Function}
 * @api public
 */

module.exports = function query(){
  return function query(req, res, next){
    req.query = ~req.url.indexOf('?')
      ? qs.parse(parse(req.url).query)
      : {};
    next();
  };
};

@@ -330,16 +330,17 @@
 connect(
+)
 %0A *     
@@ -341,18 +341,21 @@
 *       
-  
+.use(
 connect.
@@ -361,16 +361,17 @@
 .query()
+)
 %0A *     
@@ -372,18 +372,21 @@
 *       
-, 
+.use(
 function
@@ -458,29 +458,8 @@
    %7D
-%0A *     ).listen(3000
 );%0A 

update query() docs