query.js
This file
Path
lib/middleware/query.js
30 lines · 506 bytes · JavaScript
Last changed by
Not known.
History of this fileTake it
The walk stopped after 200 commits: lines older than ad3ca25 point at it.
deps: qs@1.2.2Douglas Christopher Wilsonbefore adoptionad3ca25
lines 1–30why, one step back1/**2 * Module dependencies.3 */45var parseUrl = require('parseurl');6var qs = require('qs');78/**9 * @param {Object} options10 * @return {Function}11 * @api public12 */1314module.exports = function query(options) {15 var queryparse = qs.parse;1617 if (typeof options === 'function') {18 queryparse = options;19 options = undefined;20 }2122 return function query(req, res, next){23 if (!req.query) {24 var val = parseUrl(req).query;25 req.query = queryparse(val, options);26 }2728 next();29 };30};