You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi
I'm trying to use axios to run thru a bunch of request in a post response script in a Bruno request.
I need to read out file content and use in in my script.
But on this occation and in other scenarios I can't get bru variables to work properly.
if i set a bru variable, runtime or envVar inside a function, I can read it back right after, inside the function, but not outside the function.
Same happens if I try to use global variables.
I tought the point of bru variables where that you could set and acces them anywhere in the script?
What am I doing wrong?
I'm a complete newbie to Javascript...
Here is a code. Filpath is working as it should since I get to read out the file content in the console.
I have tried to just write directly to a global variable insted of using return.
And I have tried to run fs.Readfile in a function and call the funstion and use return - no difference.
I have the same problem using axios.
I can't access the response data once outside the axios .then function.
Tried the same there to put the response or part of it into and bru variable. But it does not work.
in the above code the console.log with "APIIOT Content: " first show the complete file content. Meaning that the bru variable has been filled.
In the step after fs.fileRead the console log show Null for the API2 and
APIIOT Content2: Undefined
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi
I'm trying to use axios to run thru a bunch of request in a post response script in a Bruno request.
I need to read out file content and use in in my script.
But on this occation and in other scenarios I can't get bru variables to work properly.
if i set a bru variable, runtime or envVar inside a function, I can read it back right after, inside the function, but not outside the function.
Same happens if I try to use global variables.
I tought the point of bru variables where that you could set and acces them anywhere in the script?
What am I doing wrong?
I'm a complete newbie to Javascript...
Here is a code. Filpath is working as it should since I get to read out the file content in the console.
I have tried to just write directly to a global variable insted of using return.
And I have tried to run fs.Readfile in a function and call the funstion and use return - no difference.
I have the same problem using axios.
I can't access the response data once outside the axios .then function.
Tried the same there to put the response or part of it into and bru variable. But it does not work.
in the above code the console.log with "APIIOT Content: " first show the complete file content. Meaning that the bru variable has been filled.
In the step after fs.fileRead the console log show Null for the API2 and
APIIOT Content2: Undefined
What is the problem?
Beta Was this translation helpful? Give feedback.
All reactions