Do not keep adding sessionId and id to optional parameters

This commit is contained in:
Isaac Murchie
2016-12-20 10:37:23 -05:00
parent d6681d61bc
commit 65807af9fc
2 changed files with 8 additions and 7 deletions
+7 -6
View File
@@ -74,10 +74,14 @@ function checkParams (paramSets, jsonObj) {
}
// some clients pass in the session id in the params
optionalParams.push('sessionId');
if (optionalParams.indexOf('sessionId') === -1) {
optionalParams.push('sessionId');
}
// some clients pass in an element id in the params
optionalParams.push('id');
if (optionalParams.indexOf('id') === -1) {
optionalParams.push('id');
}
// go through the required parameters and check against our arguments
for (let params of requiredParams) {
@@ -110,7 +114,6 @@ function makeArgs (reqParams, jsonObj, payloadParams) {
}
}
let args = _.flatten(realRequiredParams).map((p) => jsonObj[p]);
if (payloadParams.optional) {
args = args.concat(_.flatten(payloadParams.optional).map((p) => jsonObj[p]));
}
@@ -158,10 +161,8 @@ function routeConfiguringFunction (driver) {
return function (app) {
for (let [path, methods] of _.toPairs(METHOD_MAP)) {
for (let [method, spec] of _.toPairs(methods)) {
let isSessCmd = isSessionCommand(spec.command);
// set up the express route handler
buildHandler(app, method, path, spec, driver, isSessCmd);
buildHandler(app, method, path, spec, driver, isSessionCommand(spec.command));
}
}
};
+1 -1
View File
@@ -38,7 +38,7 @@ describe('MJSONWP', () => {
}
var hash = shasum.digest('hex').substring(0, 8);
// Modify the hash whenever the protocol has intentionally been modified.
hash.should.equal('5b035b99');
hash.should.equal('f5aec588');
});
});