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
|
// extracts command params from request
|
||||||
this.express.use(function(req, res, next) {
|
this.express.use(function(req, res, next) {
|
||||||
var method = req.method.toLowerCase(),
|
|
||||||
container = {};
|
|
||||||
|
|
||||||
req.commandParams = [];
|
req.commandParams = [];
|
||||||
|
|
||||||
if (method === 'get' || Object.keys(req.query).length > 0) {
|
for (var p in req.body) {
|
||||||
container = req.query;
|
req.commandParams.push(req.body[p]);
|
||||||
} else if (typeof(req.body) === 'object') {
|
|
||||||
container = req.body;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var p in container) {
|
|
||||||
req.commandParams.push(container[p]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return next();
|
return next();
|
||||||
|
|
Loading…
Reference in New Issue