mirror of
https://github.com/usebruno/bruno.git
synced 2024-12-23 07:09:01 +01:00
fix: getRequestVar shim, boolean values in vm (#2887)
This commit is contained in:
parent
e31c552dee
commit
4aff61b665
@ -63,6 +63,12 @@ const addBruShimToContext = (vm, bru) => {
|
|||||||
vm.setProp(bruObject, 'getSecretVar', getSecretVar);
|
vm.setProp(bruObject, 'getSecretVar', getSecretVar);
|
||||||
getSecretVar.dispose();
|
getSecretVar.dispose();
|
||||||
|
|
||||||
|
let getRequestVar = vm.newFunction('getRequestVar', function (key) {
|
||||||
|
return marshallToVm(bru.getRequestVar(vm.dump(key)), vm);
|
||||||
|
});
|
||||||
|
vm.setProp(bruObject, 'getRequestVar', getRequestVar);
|
||||||
|
getRequestVar.dispose();
|
||||||
|
|
||||||
const sleep = vm.newFunction('sleep', (timer) => {
|
const sleep = vm.newFunction('sleep', (timer) => {
|
||||||
const t = vm.getString(timer);
|
const t = vm.getString(timer);
|
||||||
const promise = vm.newPromise();
|
const promise = vm.newPromise();
|
||||||
|
@ -10,7 +10,7 @@ const marshallToVm = (value, vm) => {
|
|||||||
} else if (typeof value === 'number') {
|
} else if (typeof value === 'number') {
|
||||||
return vm.newNumber(value);
|
return vm.newNumber(value);
|
||||||
} else if (typeof value === 'boolean') {
|
} else if (typeof value === 'boolean') {
|
||||||
return vm.newBoolean(value);
|
return value ? vm.true : vm.false;
|
||||||
} else if (typeof value === 'object') {
|
} else if (typeof value === 'object') {
|
||||||
if (Array.isArray(value)) {
|
if (Array.isArray(value)) {
|
||||||
const arr = vm.newArray();
|
const arr = vm.newArray();
|
||||||
|
Loading…
Reference in New Issue
Block a user