Skip to content
Open
Show file tree
Hide file tree
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
23 changes: 15 additions & 8 deletions testing/script/request-chaining.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,29 @@

```javascript showLineNumbers
const requestResponse = await bru.runRequest(
"absolute/path/to/a/request/from/collection/root"
"folder/subfolder/request-name"
);
```

### Parameters

- **requestPath**: The absolute path to the request from the collection root (string)
- **requestPath**: The path to the request relative to the collection root, using folder names as segments and the request name (without the `.bru` extension) as the last segment. For a request that lives directly at the collection root, pass just the request name — for example `bru.runRequest("Login")`. For a request nested inside folders, join the folder names with `/` — for example `bru.runRequest("auth/Login")`. The path is resolved from the collection root, not relative to the calling request.

Check warning on line 33 in testing/script/request-chaining.mdx

View check run for this annotation

Mintlify / Mintlify Validation (bruno-a6972042) - vale-spellcheck

testing/script/request-chaining.mdx#L33

Did you really mean 'requestPath'?

### Returns

Returns a response object containing:
- `status`: HTTP status code
- `statusText`: HTTP status text
Returns a response object with the following fields:

- `status`: HTTP status code (number)
- `statusText`: HTTP status text (string)
- `headers`: Response headers object
- `body`: Response body (automatically parsed if JSON)
- `responseTime`: Response time in milliseconds
- `data`: Parsed response body — automatically decoded to a JavaScript object when the response is JSON, otherwise a string
- `duration`: Response time in milliseconds
- `size`: Response size in bytes
- `url`: The final request URL

<Info>
The parsed body lives on `response.data`, not `response.body`. This differs from the `res` object available in post-response and test scripts, where the body is exposed as `res.body` / `res.getBody()`.
</Info>

### Examples

Expand All @@ -51,7 +58,7 @@

// Check if login was successful
if (response.status === 200) {
const data = response.body;
const data = response.data;
bru.setVar("authToken", data.token);
console.log("Login successful, token saved");
} else {
Expand Down Expand Up @@ -152,7 +159,7 @@

### Parameters

- **requestName**: The name of the next request to execute (string) or `null` to stop execution

Check warning on line 162 in testing/script/request-chaining.mdx

View check run for this annotation

Mintlify / Mintlify Validation (bruno-a6972042) - vale-spellcheck

testing/script/request-chaining.mdx#L162

Did you really mean 'requestName'?

### How it works

Expand Down
23 changes: 15 additions & 8 deletions v2/testing/script/request-chaining.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,29 @@

```javascript
const requestResponse = await bru.runRequest(
"absolute/path/to/a/request/from/collection/root"
"folder/subfolder/request-name"
);
```

### Parameters

- **requestPath**: The absolute path to the request from the collection root (string)
- **requestPath**: The path to the request relative to the collection root, using folder names as segments and the request name (without the `.bru` extension) as the last segment. For a request at the collection root, pass just the request name (e.g. `"Login"`). For a nested request, join the folder names with `/` (e.g. `"auth/Login"`).

Check warning on line 33 in v2/testing/script/request-chaining.mdx

View check run for this annotation

Mintlify / Mintlify Validation (bruno-a6972042) - vale-spellcheck

v2/testing/script/request-chaining.mdx#L33

Did you really mean 'requestPath'?

### Returns

Returns a response object containing:
- `status`: HTTP status code
- `statusText`: HTTP status text
Returns a response object with the following fields:

- `status`: HTTP status code (number)
- `statusText`: HTTP status text (string)
- `headers`: Response headers object
- `body`: Response body (automatically parsed if JSON)
- `responseTime`: Response time in milliseconds
- `data`: Parsed response body — automatically decoded to a JavaScript object when the response is JSON, otherwise a string
- `duration`: Response time in milliseconds
- `size`: Response size in bytes
- `url`: The final request URL

<Callout type="info" emoji="">
The parsed body lives on `response.data`, not `response.body`. This differs from the `res` object in post-response and test scripts, where the body is exposed as `res.body` / `res.getBody()`.
</Callout>

### Examples

Expand All @@ -51,7 +58,7 @@

// Check if login was successful
if (response.status === 200) {
const data = response.body;
const data = response.data;
bru.setVar("authToken", data.token);
console.log("Login successful, token saved");
} else {
Expand Down Expand Up @@ -152,7 +159,7 @@

### Parameters

- **requestName**: The name of the next request to execute (string) or `null` to stop execution

Check warning on line 162 in v2/testing/script/request-chaining.mdx

View check run for this annotation

Mintlify / Mintlify Validation (bruno-a6972042) - vale-spellcheck

v2/testing/script/request-chaining.mdx#L162

Did you really mean 'requestName'?

### How it works

Expand Down
23 changes: 15 additions & 8 deletions v3/testing/script/request-chaining.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,29 @@

```javascript showLineNumbers
const requestResponse = await bru.runRequest(
"absolute/path/to/a/request/from/collection/root"
"folder/subfolder/request-name"
);
```

### Parameters

- **requestPath**: The absolute path to the request from the collection root (string)
- **requestPath**: The path to the request relative to the collection root, using folder names as segments and the request name (without the `.bru` extension) as the last segment. For a request at the collection root, pass just the request name (e.g. `"Login"`). For a nested request, join the folder names with `/` (e.g. `"auth/Login"`).

Check warning on line 33 in v3/testing/script/request-chaining.mdx

View check run for this annotation

Mintlify / Mintlify Validation (bruno-a6972042) - vale-spellcheck

v3/testing/script/request-chaining.mdx#L33

Did you really mean 'requestPath'?

### Returns

Returns a response object containing:
- `status`: HTTP status code
- `statusText`: HTTP status text
Returns a response object with the following fields:

- `status`: HTTP status code (number)
- `statusText`: HTTP status text (string)
- `headers`: Response headers object
- `body`: Response body (automatically parsed if JSON)
- `responseTime`: Response time in milliseconds
- `data`: Parsed response body — automatically decoded to a JavaScript object when the response is JSON, otherwise a string
- `duration`: Response time in milliseconds
- `size`: Response size in bytes
- `url`: The final request URL

<Info>
The parsed body lives on `response.data`, not `response.body`. This differs from the `res` object in post-response and test scripts, where the body is exposed as `res.body` / `res.getBody()`.
</Info>

### Examples

Expand All @@ -51,7 +58,7 @@

// Check if login was successful
if (response.status === 200) {
const data = response.body;
const data = response.data;
bru.setVar("authToken", data.token);
console.log("Login successful, token saved");
} else {
Expand Down Expand Up @@ -152,7 +159,7 @@

### Parameters

- **requestName**: The name of the next request to execute (string) or `null` to stop execution

Check warning on line 162 in v3/testing/script/request-chaining.mdx

View check run for this annotation

Mintlify / Mintlify Validation (bruno-a6972042) - vale-spellcheck

v3/testing/script/request-chaining.mdx#L162

Did you really mean 'requestName'?

### How it works

Expand Down