Skip to content

Commit 812b781

Browse files
chore: add section on following redirects to HTTP requests (#1628)
* chore: add section on following redirects to HTTP requests * Update docs/sources/next/using-k6/http-requests.md Co-authored-by: Mihail Stoykov <[email protected]> * chore: apply to v0.52.x --------- Co-authored-by: Mihail Stoykov <[email protected]>
1 parent 5136b3d commit 812b781

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

docs/sources/next/using-k6/http-requests.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ The [http module](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-htt
6666
| [put()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-http/put) | Issue an HTTP PUT request. |
6767
| [request()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-http/request) | Issue any type of HTTP request. |
6868

69+
## Follow redirects
70+
71+
By default, k6 automatically follows a set number of redirects before stopping and returning the last response. You can customize this by using:
72+
73+
- The `maxRedirects` option to customize the number of redirects globally. Refer to [Max redirects](https://grafana.com/docs/k6/<K6_VERSION>/using-k6/k6-options/reference/#max-redirects) for more details.
74+
- The `Params.redirects` property to customize the number of redirects for a specific request, which overrides the `maxRedirects` option. Refer to [Params](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-http/params/) for more details.
75+
6976
## HTTP Request Tags
7077

7178
k6 automatically applies [tags](https://grafana.com/docs/k6/<K6_VERSION>/using-k6/tags-and-groups#section-tags) to your HTTP requests.

docs/sources/v0.52.x/using-k6/http-requests.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ The [http module](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-htt
6666
| [put()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-http/put) | Issue an HTTP PUT request. |
6767
| [request()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-http/request) | Issue any type of HTTP request. |
6868

69+
## Follow redirects
70+
71+
By default, k6 automatically follows a set number of redirects before stopping and returning the last response. You can customize this by using:
72+
73+
- The `maxRedirects` option to customize the number of redirects globally. Refer to [Max redirects](https://grafana.com/docs/k6/<K6_VERSION>/using-k6/k6-options/reference/#max-redirects) for more details.
74+
- The `Params.redirects` property to customize the number of redirects for a specific request, which overrides the `maxRedirects` option. Refer to [Params](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-http/params/) for more details.
75+
6976
## HTTP Request Tags
7077

7178
k6 automatically applies [tags](https://grafana.com/docs/k6/<K6_VERSION>/using-k6/tags-and-groups#section-tags) to your HTTP requests.

0 commit comments

Comments
 (0)