bruno
bruno copied to clipboard
JavaScript API changed, unable to set variables,
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
I recently updated Bruno to the latest version and noticed my pre request scripts were failing because bru.getProcessEnv() and bru.getVar() were null. I see now that the bru object no longer has these functions and instead has processEnvVars and requestVariables properties. The documentation only mentions the functions that are no longer present.
The issue I have is though I can retrieve variables using the properties mentioned above, I can't set them there. The bru.setVar() function was removed. If I assign values to them, they aren't actually saved. I need to be able to save variables for my login flow.
.bru file to reproduce the bug
No response
Screenshots/Live demo link
I have reproduced this issue with bruno versions 1.20.4, 1.20.1, 1.19.0 and 1.17.0
I'm not sure i understand your issue correctly, you can't log "bru.getVar" but you can still use the method :
Logs will look like that :
Indeed, something is wrong. bru.getVar is not working. Version: 1.22.0
I found the solution in other issue, use bru.getRequestVar() instead of bru.getVar()
https://github.com/usebruno/bruno/issues/2556#issuecomment-2228163546
I've tested both of these APIs in the latest version, and they're working fine. I'm closing this issue, but feel free to reopen it if the problem persists.