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
Let's say you have a login.hurl which logins the user and captures the token in a variable. I would like to use this variable with any number of requests after that, possibly in multiple sessions.
Postman supports this using "tests" which is just javascript code where you can modify the environment.
Proposal
Support saving and loading variables to an environment file.
Support a new type of variable:
POST https://foo.com/login
...
HTTP 200
[Captures]
env:token = jsonpath "$.token"
For example:
Below command would load all the env variables from env.json at the beginning and save token to env.json at the end.
hurl --env=env.json login.hurl
A different hurl file could use this env like so:
hurl --env=env.json requests.hurl
requests.hurl
GET https://foo.com/api/things
Authorizaton: Bearer {{env:token}}
Additional context and resources
Tasks to complete
...
The text was updated successfully, but these errors were encountered:
Hi @95th ,
Reading variables from a file is supported with the variable-file option.
Relating to writing variables to a file at the end of the test:
it can be done currently from the JSON output with an additional command line using jq.
we could maybe add a dedicated option for that. This seems very similar to reading/writing cookies to a file. Note that the curl/Hurl are not very intuitive (--cookie, ---cookie-jar)
Problem to solve
Let's say you have a
login.hurl
which logins the user and captures the token in a variable. I would like to use this variable with any number of requests after that, possibly in multiple sessions.Postman supports this using "tests" which is just javascript code where you can modify the environment.
Proposal
Support saving and loading variables to an environment file.
Support a new type of variable:
For example:
Below command would load all the env variables from env.json at the beginning and save token to
env.json
at the end.A different
hurl
file could use this env like so:Additional context and resources
Tasks to complete
The text was updated successfully, but these errors were encountered: