@globocom/backstage-functions-sandbox
Advanced tools
Comparing version 0.3.1 to 0.3.2
@@ -40,3 +40,9 @@ const vm = require('vm'); | ||
const defaultAsyncTimeout = 5000; | ||
const codeFoot = 'return main.call(null, Backstage.request, Backstage.response);'; | ||
const codeFoot = ( | ||
'if (main.constructor.name === \'AsyncFunction\') {' + | ||
'return main.call(null, Backstage.request, Backstage.response);' + | ||
'} else {' + | ||
'main.call(null, Backstage.request, Backstage.response);' + | ||
'}' | ||
); | ||
@@ -43,0 +49,0 @@ class Sandbox { |
{ | ||
"name": "@globocom/backstage-functions-sandbox", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "Sandbox for Backstage functions", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -265,3 +265,3 @@ const expect = require('chai').expect; | ||
const filename = 'test.js'; | ||
const code = 'function main(req){ return {a: 1}; }'; | ||
const code = 'function main(req, res){ res.send({ a: 1 }); return \'ok\'; }'; | ||
const script = testSandbox.compileCode(filename, code); | ||
@@ -268,0 +268,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43292
1059