Only look for command params in POST bodies

This commit is contained in:
Andrew Stewart 2014-07-17 12:07:49 -07:00
parent 6b1d6e2653
commit c97514689b
1 changed files with 2 additions and 11 deletions

View File

@ -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();