Handle string

This commit is contained in:
Anthony Laibe 2018-08-31 12:00:16 +01:00 committed by Pascal Precht
parent e4fd9ab3ba
commit e31f4778ac
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
1 changed files with 3 additions and 0 deletions

View File

@ -32,6 +32,9 @@ class Console {
let plugin = this.plugins.createPlugin('consoleApi', {}); let plugin = this.plugins.createPlugin('consoleApi', {});
plugin.registerAPICall('post', '/embark-api/command', (req, res) => { plugin.registerAPICall('post', '/embark-api/command', (req, res) => {
this.executeCmd(req.body.command, (_err, result) => { this.executeCmd(req.body.command, (_err, result) => {
if (typeof result === 'string') {
return res.send({result});
}
res.send({result: stringify(result, null, 2)}); res.send({result: stringify(result, null, 2)});
}); });
}); });