Generate Code doesn't pickup body changes until saved
I have checked the following:
- [x] I have searched existing issues and found nothing related to my issue.
This bug is:
- [ ] making Bruno unusable for me
- [ ] slowing me down but I'm able to continue working
- [x] annoying
- [ ] this feature was working in a previous version but is broken in the current release.
Bruno version
2.3.0
Operating System
Linux
Describe the bug
I have some requests in a collection that I often refer to as a template to start (debugging) from. One such template is a POST with a JSON body. Whenever I modify a value in the request body and then press Generate Code it does not pickup the changes in the generated code. Instead I first have to save, then press generate. I find this to be inconvenient as I have to overwrite my collection, generate, then undo + save to restore my template to original.
.bru file to reproduce the bug
No response
Screenshots/Live demo link
It also doesn't swap variables for the the values, make the curl somewhat useless if you use them.
curl --request POST \
--url http://localhost:3000/foo \
--header 'content-type: application/json' \
--data '{
"bar": "{{varBar}}"
}'
it should return
curl --request POST \
--url http://localhost:3000/foo \
--header 'content-type: application/json' \
--data '{
"bar": "value-of-varBar"
}'
I agree, variable rendering could be the best fix, in order to use generated curl
@dvictory @gioacchino-mauro variable interpolation option will be added by this PR https://github.com/usebruno/bruno/pull/4345
Currently code gen is implement on top of the saved request. Let me check with the team and get back to you on that. JIRA
@anusree-bruno do you happen to have an update on this? At least hoping to learn if they agree this is unintentional behaviour
Hey @ixje, we’re aligned that the desired behavior is to generate code based on the current state of the request, not just the saved version.
Thank you. Looking forward to the fix
I see that this has been fixed from v2.4.0. Attaching a screen recording tested on v2.6.1
https://github.com/user-attachments/assets/74abc55d-8642-4a8a-b5da-84a8bffe1fc2
I can confirm this is working on 2.6.1