Commit 1e8e41f5 authored by Tristan Cavelier's avatar Tristan Cavelier

jio.js updated

parent 6f7c661d
...@@ -2171,16 +2171,18 @@ function restCommandRejecter(param, args) { ...@@ -2171,16 +2171,18 @@ function restCommandRejecter(param, args) {
"message": "Command failed", "message": "Command failed",
"reason": "unknown" "reason": "unknown"
}, },
// 2 - status, reason, message parameters // 2 - status, reason, message properties
{}, {},
// 3 - never change // 3 - status, reason, message parameters
{},
// 4 - never change
{"result": "error", "method": param.method} {"result": "error", "method": param.method}
]; ];
args = Array.prototype.slice.call(args); args = Array.prototype.slice.call(args);
arg = args.shift(); arg = args.shift();
// priority 3 - never change // priority 4 - never change
current_priority = priority[3]; current_priority = priority[4];
if (param.kwargs._id) { if (param.kwargs._id) {
current_priority.id = param.kwargs._id; current_priority.id = param.kwargs._id;
} }
...@@ -2188,8 +2190,8 @@ function restCommandRejecter(param, args) { ...@@ -2188,8 +2190,8 @@ function restCommandRejecter(param, args) {
current_priority.attachment = param.kwargs._attachment; current_priority.attachment = param.kwargs._attachment;
} }
// priority 2 - status, reason, message parameters // priority 3 - status, reason, message parameters
current_priority = priority[2]; current_priority = priority[3];
// parsing first parameter if is not an object // parsing first parameter if is not an object
if (typeof arg !== 'object' || arg === null || Array.isArray(arg)) { if (typeof arg !== 'object' || arg === null || Array.isArray(arg)) {
// first parameter is mandatory // first parameter is mandatory
...@@ -2211,11 +2213,12 @@ function restCommandRejecter(param, args) { ...@@ -2211,11 +2213,12 @@ function restCommandRejecter(param, args) {
arg = args.shift(); arg = args.shift();
} }
// priority 0 - custom values
current_priority = priority[0];
// parsing fourth parameter if is an object // parsing fourth parameter if is an object
if (typeof arg === 'object' && arg !== null && !Array.isArray(arg)) { if (typeof arg === 'object' && arg !== null && !Array.isArray(arg)) {
dictUpdate(current_priority, arg); // priority 0 - custom values
dictUpdate(priority[0], arg);
// priority 2 - status, reason, message properties
current_priority = priority[2];
if (arg.hasOwnProperty('reason')) { if (arg.hasOwnProperty('reason')) {
current_priority.reason = arg.reason; current_priority.reason = arg.reason;
} }
...@@ -2273,9 +2276,11 @@ function restCommandResolver(param, args) { ...@@ -2273,9 +2276,11 @@ function restCommandResolver(param, args) {
{}, {},
// 1 - default values // 1 - default values
{}, {},
// 2 - status parameter // 2 - status property
{},
// 3 - status parameter
{}, {},
// 3 - never change // 4 - never change
{"result": "success", "method": param.method} {"result": "success", "method": param.method}
]; ];
args = Array.prototype.slice.call(args); args = Array.prototype.slice.call(args);
...@@ -2304,8 +2309,8 @@ function restCommandResolver(param, args) { ...@@ -2304,8 +2309,8 @@ function restCommandResolver(param, args) {
current_priority.statusText = constants.http_status_text.ok; current_priority.statusText = constants.http_status_text.ok;
} }
// priority 2 - status parameter // priority 3 - status parameter
current_priority = priority[2]; current_priority = priority[3];
// parsing first parameter if is not an object // parsing first parameter if is not an object
if (typeof arg !== 'object' || arg === null || Array.isArray(arg)) { if (typeof arg !== 'object' || arg === null || Array.isArray(arg)) {
if (arg !== undefined) { if (arg !== undefined) {
...@@ -2314,11 +2319,14 @@ function restCommandResolver(param, args) { ...@@ -2314,11 +2319,14 @@ function restCommandResolver(param, args) {
arg = args.shift(); arg = args.shift();
} }
// priority 0 - custom values
current_priority = priority[0];
// parsing second parameter if is an object // parsing second parameter if is an object
if (typeof arg === 'object' && arg !== null && !Array.isArray(arg)) { if (typeof arg === 'object' && arg !== null && !Array.isArray(arg)) {
// priority 0 - custom values
dictUpdate(current_priority, arg); dictUpdate(current_priority, arg);
// priority 2 - status property
if (arg.hasOwnProperty("status") || arg.hasOwnProperty("statusText")) {
priority[2].status = arg.statusText || arg.status;
}
} }
// merge priority dicts // merge priority dicts
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment