Skip to content

Commit

Permalink
Merge pull request #448 from fengmk2/master
Browse files Browse the repository at this point in the history
Pass `options` to qs.parse function
  • Loading branch information
tj committed Feb 28, 2012
2 parents 6364e24 + 66f0c0b commit 6f303fb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions lib/middleware/query.js
Expand Up @@ -27,14 +27,17 @@ var qs = require('qs')
* res.end(JSON.stringify(req.query));
* });
*
* The `options` passed are provided to qs.parse function.
*
* @param {Object} options
* @return {Function}
* @api public
*/

module.exports = function query(){
module.exports = function query(options){
return function query(req, res, next){
req.query = ~req.url.indexOf('?')
? qs.parse(parse(req.url).query)
? qs.parse(parse(req.url).query, options)
: {};
next();
};
Expand Down
2 changes: 1 addition & 1 deletion lib/middleware/urlencoded.js
Expand Up @@ -46,7 +46,7 @@ exports = module.exports = function(options){
req.on('end', function(){
try {
req.body = buf.length
? qs.parse(buf)
? qs.parse(buf, options)
: {};
next();
} catch (err){
Expand Down

0 comments on commit 6f303fb

Please sign in to comment.