Request variables are variables that are scoped to a specific request. They are useful for storing variables that is used in a specific request.
Creating a Request Variable
- Go to the Request
- Go to Vars Tab
- Add your variable name, value, and an optional description for what the variable represents in the Pre Request Vars section
- Save your changes
Using a Request Variable
You can use the {{varName}} syntax to use a request variable in a request.
Access Request Variable inside scripts
You can also use the bru.getRequestVar() function to get the value of a request variable and use it inside your scripts.
Deleting a Request Variable
Request variables are stored in the request file itself. To delete one, remove the row from the Vars tab:
- Open the request.
- Go to the Vars tab.
- Hover over the variable row in the Pre Request Vars section and click the delete icon.
- Save the request.
bru.deleteVar() and bru.deleteAllVars() remove runtime variables only. They do not delete request variables defined on the Vars tab.