Only look for command params in POST bodies
This commit is contained in:
parent
6b1d6e2653
commit
c97514689b
13
lib/api.js
13
lib/api.js
|
@ -43,19 +43,10 @@ var API = module.exports = function API(opts) {
|
|||
|
||||
// extracts command params from request
|
||||
this.express.use(function(req, res, next) {
|
||||
var method = req.method.toLowerCase(),
|
||||
container = {};
|
||||
|
||||
req.commandParams = [];
|
||||
|
||||
if (method === 'get' || Object.keys(req.query).length > 0) {
|
||||
container = req.query;
|
||||
} else if (typeof(req.body) === 'object') {
|
||||
container = req.body;
|
||||
}
|
||||
|
||||
for (var p in container) {
|
||||
req.commandParams.push(container[p]);
|
||||
for (var p in req.body) {
|
||||
req.commandParams.push(req.body[p]);
|
||||
}
|
||||
|
||||
return next();
|
||||
|
|
Loading…
Reference in New Issue