-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Var used in POST's request body (JSON body) not being identified and evaluated correctly #1910
Comments
Sounds a bit like the issue #1635 If possible, you could try and downgrade to v1.6.1 and try again. So you could at least verify that bug. |
I'm using v1.12.2, adding it to the issue's description! The new features were good though :( |
Yes :/ i really liked them as well. But i had to downgrade as my requests really depend on that feature to work :/ |
Thank so much for your help, downgrading as well over here then! |
Interpolate will now fallback to the original object to collect variable values. Objets will automaticly json encoded. And if intererpolate is executed for the json body all variables will be json encoded so strings get double quoted. This should fix: - usebruno#1910 - usebruno#1635
@dw-0 @nlassaux @Nerkho @q587p I implemented a fix in my fork: https://github.com/Its-treason/bruno/releases/tag/nightly that should hopefully fix your problem. Could test it locally and give feedback on whether it fixes your Issue? I will open a PR then. The fork can safely be installed next to mainline Bruno. |
@Its-treason Sounds good! I will give it a try tomorrow and report back. Thank you. |
@Its-treason Hey! First short feedback after the first short try this morning. I wasn't able to test anything really, as the program just showed a white page when i clicked on the little eye icon on the left side of the environment dropdown. Same happend when clicked on "configure" in the env dropdown. Env variables seem to be used in the request url, but not in the body. |
Hey @dw-0, thank you for testing it and the feedback
I fixed the white screen bug in the variable viewer. This happened because of changes in #650 where the collection variables were not treated as an object but as an array. But I'm unsure about the problem with the env-variable viewer.
The editor does seem to recognize the collection variables, but they should be sent with the request. I used this collection for testing. With the fork: Mainline Bruno: |
@Its-treason Hi! You are right, with your provided collection, the environment variables are correctly interpolated. Im unsure why it did not work with my collection this morning. But it seems like this request is not working: Am I doing something wrong? Or what is going on here? :D What i noticed is, this is working: |
Now the invalid JSON will be written into the body instead of the pre interpolated body.
Now the invalid JSON will be written into the body instead of the pre interpolated body.
For example with Moment the object with JSON.stringify became: `"Mon Mar 25 2024 22:52:03 GMT+0100"` when using just `toString` the moment object becomes `Mon Mar 25 2024 22:52:03 GMT+0100` (without double quotes). I think the should yield more expected results.
Alright @dw-0, thank you again for testing it with my collection. I found out why the variables were not replaced in your example. {
"format_now": "2024-03-25 22:52:03.883",
"nom": ""Mon Mar 25 2024 22:52:03 GMT+0100"",
"password": "bionicman",
"username": "dc"
} This could be parsed, and the body data was not updated. So I made two more changes:
|
Interpolate will now fallback to the original object to collect variable values. Objets will automaticly json encoded. And if intererpolate is executed for the json body all variables will be json encoded so strings get double quoted. This should fix: - usebruno#1910 - usebruno#1635
Now the invalid JSON will be written into the body instead of the pre interpolated body.
For example with Moment the object with JSON.stringify became: `"Mon Mar 25 2024 22:52:03 GMT+0100"` when using just `toString` the moment object becomes `Mon Mar 25 2024 22:52:03 GMT+0100` (without double quotes). I think the should yield more expected results.
@Its-treason Hi! So i tested your latest nightly today. In the morning i tested it at work, with the collection im using there. An i encountered the "white screen" issue again once i clicked on the little eye icon beside the env dropdown again. And it also appeared again, when i wanted to open the configure menu for the envs. I am not sure why this is happening only with the collection at work. Because just a minute ago i tested it with the test-collection from our conversation here, and it is working fine. Anyways, with the current testing collection from this conversation, everything seems to work again! |
Okay, thanks for the hint. Seems like my implementation of that feature wasn't bulletproof enough ^^ |
Some news about this? |
Hi, Please let us know when this fix will be available, as this is one of important feature which we are looking forward while working with Bruno. |
I cannot find a workaround for this bug. I'm unable to send any POST request with a JSON containing variables. |
The issue is still there. I was using 1.17 version, then one day it just stopped using proper variables from one of my envs with secrets. My colleague on 1.21 ver has no problems (though we share the same repo source). |
Can confirm issue still persists on OSX version 1.23.1 |
snap, the same here on v1.30.1 on mac silicone. Env vars using |
I'm on v1.34.0 and this still isn't fixed. Variables are not detected correctly in JSON mode. A workaround I found is to leave the body blank and use the Not pretty, but it works. |
I am on 1.38.1 already and also have the same problem. Is there any news here? thanks! |
I have a Var that's declared, but I can't manage to use it as part of a json body.
Now I'm trying to use it in that JSON body:
The documentation doesn't show any example for POST requests + JSON body. But do we agree that this variable should be sent in theory?
Version: v1.12.2
The text was updated successfully, but these errors were encountered: