Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed not working links and tuned formatting #74 #87

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/pages/scripting/vars.mdx
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# Vars
# Vars tab

Vars allow you to set variables before request, and after you receive the response.
**Vars** tab allows you to set variables:
- before request and
- after you receive the response.

Vars are scoped within the request and cannot be accessed outside of it.
Variables are scoped within the request and cannot be accessed outside of it.

> Note: Prior to v1.20.0, request vars were accessible at the collection scope, but this is no longer the case.

In the *Pre Request Variables* section, you can write any Strings, Numbers or any valid JavaScript literal.
In the **Vars** tab > **Pre Request** variables section, you can write any strings, numbers or any valid JavaScript literal.

In the *Post Response Variables* section, you can write any valid JavaScript expression. The res object is available, allowing you to declaratively parse the [response](./javascript-reference.html#response) and set variables, instead of writing scripts to do the same.
In the **Vars** tab > **Post Response** variables section, you can write any valid JavaScript expression. The `res` object is available, allowing you to declaratively parse the [response object](/scripting/response/response-object) and set variables, instead of writing scripts to do the same.

For parsing the response, you can checkout the [response query](./response-object) that allows you to easily query your response.
For parsing the response, you can checkout the [response query](/scripting/response/response-query) that allows you to easily query your response.

**Example:**
![bru vars](/screenshots/vars.webp)
Expand Down