1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Fix context admin api for empty contexts

This commit is contained in:
Nick O'Leary 2018-07-03 21:18:43 +01:00
parent 9bbe405cd0
commit 4e4a1f11e6
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -50,6 +50,9 @@ module.exports = {
ctx.keys(function(err, keys) { ctx.keys(function(err, keys) {
var result = {}; var result = {};
var c = keys.length; var c = keys.length;
if (c === 0) {
res.json(result);
} else {
keys.forEach(function(key) { keys.forEach(function(key) {
ctx.get(key,function(err, v) { ctx.get(key,function(err, v) {
result[key] = util.encodeObject({msg:v}); result[key] = util.encodeObject({msg:v});
@ -59,6 +62,7 @@ module.exports = {
} }
}); });
}); });
}
}); });
} }
} else { } else {