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
I'd like to be able to specify a value as a file location that automatically resolves and the content of the file gets put into the variable. E.g. jwt below would have the value of file:///Users/nl/work/data/jwt. This would facility not having to paste the JWT each time.
Currently, there is no built-in function for reading files, but there is a workaround. Since the script runs on GraalVM JS, you can use Java classes. To read a file and assign its content to a variable, you can write the following in your pre-request script:
Added the jc.readFile function to read file contents. You can now set a variable's value to the contents of a file using this script: jc.variables.set("jwt", jc.readFile('path')).
In the future, I plan to implement inline functions for variable values, like this: jwt: {{readFile('path')}}
Is your feature request related to a problem?
No
Describe the solution you'd like
I'd like to be able to specify a value as a file location that automatically resolves and the content of the file gets put into the variable. E.g. jwt below would have the value of file:///Users/nl/work/data/jwt. This would facility not having to paste the JWT each time.
{
staging: {
baseUrl: "https://taskmanagement.cognosos.dev/api/v0",
jwt: "file:///Users/nl/work/data/jwt"
},
}
Additional context
No response
The text was updated successfully, but these errors were encountered: