Bruno can't access to collection level variables in Safe mode.
I have checked the following:
- [X] I use the newest version of bruno.
- [X] I've searched existing issues and found nothing related to my issue.
Describe the bug
Bruno can't access to collection level variables in Safe mode. I guess it is.
.bru file to reproduce the bug
No response
Screenshots/Live demo link
Failed GET request
Collection level variable is defined
In Dev mod all fine
Thanks for reporting the issue @SPIRIT-00 We are taking a look at it.
@SPIRIT-00 IN the screenshot you shared, the api url in the first screenshot is different compared to the API in the second screenshot.
Are you using scripting to update the API endpoint? Also are you using external npm modules in the collection (Safe mode does not support loading external modules)
@SPIRIT-00 IN the screenshot you shared, the api url in the first screenshot is different compared to the API in the second screenshot.
Are you using scripting to update the API endpoint? Also are you using external npm modules in the collection (Safe mode does not support loading external modules)
I use this pre-req script to set Endpoint. It takes request level variables and redefine url. Endpoint path on screen broken because scripts can't get collection and local variables values.
// url эндпоинта. const isLink = bru.getRequestVar('isLink'), url = req.getUrl(), testField = bru.getRequestVar('testField'), findOneId = bru.getRequestVar('findOneId'), tooLongId = bru.getRequestVar('tooLongId'), notExistId = bru.getRequestVar('notExistId'), propName = bru.getRequestVar('propName'), propValue = bru.getRequestVar('propValue'), id1 = bru.getRequestVar('id1'), id2 = bru.getRequestVar('id2'); let targetUrl = ``, body = req.getBody();
if (isLink) {
targetUrl = /{{table}}/${id1}/{{linkWith}}/${id2};
} else {
switch (req.method) {
case 'POST': targetUrl = /{{table}}; break
default: targetUrl = /{{table}}/${findOneId}; break
}
}
req.setUrl(url + targetUrl);
Thanks for sharing this @SPIRIT-00 !
An issue related to getRequestVar api was also fixed in v1.26.1
Can you check if it solves your issue?
@helloanoop i think it issue solved. Request level vars values can be received. But need create new issue about returned datatype of boolean values from request level vars. As can tou see on screenshots in dev mode boolean like values returns as boolean. In safe mode boolean like values returns as strings.