Skip to content
Myr

query.js

This file

Path

lib/middleware/query.js

46 lines · 863 bytes · JavaScript

Last changed by

deps: qs@6.2.0Douglas Christopher Wilsonbefore adoption999546d

History of this file

Take it

The walk stopped after 200 commits: lines older than 2a45589 point at it.

Add settings to debug outputDouglas Christopher Wilsonbefore adoption2a45589

lines 1–24why, one step back
1/*!
2 * express3 * Copyright(c) 2009-2013 TJ Holowaychuk4 * Copyright(c) 2013 Roman Shtylman5 * Copyright(c) 2014-2015 Douglas Christopher Wilson6 * MIT Licensed7 */89'use strict';1011/**12 * Module dependencies.13 */1415var parseUrl = require('parseurl');16var qs = require('qs');1718/**19 * @param {Object} options20 * @return {Function}21 * @api public22 */2324module.exports = function query(options) {

deps: qs@4.0.0Douglas Christopher Wilsonbefore adoption7bea53b

line 25why, one step back
25 var opts = Object.create(options || null);

Add settings to debug outputDouglas Christopher Wilsonbefore adoption2a45589

lines 26–29why, one step back
26 var queryparse = qs.parse;
2728 if (typeof options === 'function') {29 queryparse = options;

deps: qs@4.0.0Douglas Christopher Wilsonbefore adoption7bea53b

line 30why, one step back
30 opts = undefined;

Add settings to debug outputDouglas Christopher Wilsonbefore adoption2a45589

lines 31–32why, one step back
31 }
32

deps: qs@6.2.0Douglas Christopher Wilsonbefore adoption999546d

lines 33–35why, one step back
33 if (opts !== undefined && opts.allowPrototypes === undefined) {
34 // back-compat for qs module35 opts.allowPrototypes = true;

deps: qs@4.0.0Douglas Christopher Wilsonbefore adoption7bea53b

lines 36–37why, one step back
36 }
37

Add settings to debug outputDouglas Christopher Wilsonbefore adoption2a45589

lines 38–40why, one step back
38 return function query(req, res, next){
39 if (!req.query) {40 var val = parseUrl(req).query;

deps: qs@4.0.0Douglas Christopher Wilsonbefore adoption7bea53b

line 41why, one step back
41 req.query = queryparse(val, opts);

Add settings to debug outputDouglas Christopher Wilsonbefore adoption2a45589

lines 42–46why, one step back
42 }
4344 next();45 };46};