Closed langfeld closed 10 months ago
I'm able to reproduce this error with 100% consistency on the Windows client.
The console shows an error that says "TypeError: e.split is not a function"
It can be simple fixed on https://github.com/usebruno/bruno/blob/ba761098be216e802399e8888974377fbe6bbe4b/packages/bruno-app/src/components/SingleLineEditor/index.js#L125
by converting this.props.value
to string if it is not a string. But I think in generally it is a bit more complex issue, because If I am not mistaken Bruno allows to store env variables only as strings in bru file. So in the end this numeric value will be saved as string in bru file and not as number. Probably somebody can expect that if number was stored via setEnvVar
, then number should be retrieved if I call getEnvVar
for the same variable anytime (e.g. after application restart). And it also doesn't have to be number only, but probably more complex object. What should be done then? Should we convert object to string json representation?
So the main question here is how it should behave and whether there are any plans in future to support storing any kind of values and not only strings in env variables (in bru file).
cc: @helloanoop
Related to #847 and #950
Just merged the fix from @nguyenbavinh-decathlon !
So in the end this numeric value will be saved as string in bru file and not as number.
@martinsefcik This will still get stored as a number in the bru file. Currently bru file doesn't differentiate a string and number, everything is stored in plain text. The type is inferred at the time of loading the file.
how it should behave and whether there are any plans in future to support storing any kind of values and not only strings in env variables (in bru file).
So, as of today, we can only store strings and numbers. Due to the nature of the single line editor, it will hard to support storing arrays or objects.
In the future there is plan to support Nested Environments (#292) where a user can choose to get and set the environment by directly updating the json (in this case the environment will be a json file)
Description
There seems to be an issue with the Bruno REST client where storing a numeric value using the
bru.setEnvVar
function causes the Environment Variables overview page to fail to load. The page stays blank until Bruno is restarted. However, when storing a numeric value as a string, this issue does not occur.Steps to Reproduce
bru.setEnvVar("locationId", 123);
bru.setEnvVar("locationId", String(123));
Expected Behavior
The Environment Variables overview page should open without issues, showing the list of variables, regardless of whether the value set is numeric or a string.
Actual Behavior
When a numeric value is set with
bru.setEnvVar("locationId", 123);
, the Environment Variables overview page does not load and remains blank. Only after restarting the Bruno REST client does the page become accessible again. Conversely, setting the value as a string withbru.setEnvVar("locationId", String(123));
does not lead to this issue.Additional Information
The issue appears to be specific to setting numeric values directly. I have not encountered this problem when setting strings or booleans.
Any assistance in resolving this would be greatly appreciated.