Bruno takes 2 requests to apply the changes made by a script
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
SO: Fedora 40
Bruno takes 2 requests to apply the changes made by a script
Step1: Configure an environment with butBody var (it doesn't work in another way)
Step2: Modify script. i.e. change bar2 to bar 3
Step3: Make a request, the server will show the following body: {"foo":"bar","foo2":"bar2"}
Step3: Make another request, the server will show the following body: {"foo":"bar","foo2":"bar3"}
.bru file to reproduce the bug
meta { name: local type: http seq: 2 }
post { url: http://localhost:8000 body: json auth: none }
body:json { {{putBody}}
}
script:pre-request {
var body = {}
body.foo = "bar" body.foo2 = "bar5"
bru.setEnvVar("putBody", JSON.stringify(body));
}
Screenshots/Live demo link
https://drive.google.com/file/d/1F4tUotrimFsV5YBcaocVxjxSIGRVzKxK/view?usp=sharing
Can confirm this is happening at least since version 1.15.0. It seems like Bruno is not waiting for pre-request scripts to be completed, so if complex data generation takes place in pre-request script then variables won't be set in time for Bruno to use them on request.
Hi Yes,
I have checked and it doesn't happen in version 1.14.0 but it happens in 1.15.0
Also, in 1.14.0, It is not necessary to set the environment variable putBody to setEnvVar function works
Is this fixed in v2? I am facing the same in v2.0.1