diff --git a/docs/sources/k6/v0.54.x/examples/cookies-example.md b/docs/sources/k6/v0.54.x/examples/cookies-example.md
index 81d65d9c14..213477412b 100644
--- a/docs/sources/k6/v0.54.x/examples/cookies-example.md
+++ b/docs/sources/k6/v0.54.x/examples/cookies-example.md
@@ -25,7 +25,7 @@ import { check, group } from 'k6';
export default function () {
// Since this request redirects the `res.cookies` property won't contain the cookies
- const res = http.get('https://httpbin.test.k6.io/cookies/set?name1=value1&name2=value2');
+ const res = http.post('https://quickpizza.grafana.com/api/cookies?name1=value1&name2=value2');
check(res, {
'status is 200': (r) => r.status === 200,
});
@@ -97,9 +97,9 @@ export default function () {
// that a request must match (domain, path, HTTPS or not etc.)
// to have the cookie attached to it when sent to the server.
const jar = http.cookieJar();
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie', 'hello world', {
- domain: 'httpbin.test.k6.io',
- path: '/cookies',
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'my_cookie', 'hello world', {
+ domain: 'quickpizza.grafana.com',
+ path: '/api/cookies',
secure: true,
max_age: 600,
});
@@ -107,7 +107,7 @@ export default function () {
// As the following request is matching the above cookie in terms of domain,
// path, HTTPS (secure) and will happen within the specified "age" limit, the
// cookie will be attached to this request.
- const res = http.get('https://httpbin.test.k6.io/cookies');
+ const res = http.get('https://quickpizza.grafana.com/api/cookies');
check(res, {
'has status 200': (r) => r.status === 200,
"has cookie 'my_cookie'": (r) => r.json().cookies.my_cookie !== null,
@@ -130,10 +130,10 @@ import { check } from 'k6';
export default function () {
const jar = http.cookieJar();
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie_1', 'hello world_1');
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie_2', 'hello world_2');
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'my_cookie_1', 'hello world_1');
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'my_cookie_2', 'hello world_2');
- const res1 = http.get('https://httpbin.test.k6.io/cookies');
+ const res1 = http.get('https://quickpizza.grafana.com/api/cookies');
check(res1, {
'res1 has status 200': (r) => r.status === 200,
"res1 has cookie 'my_cookie_1'": (r) => r.json().cookies.my_cookie_1 !== null,
@@ -142,9 +142,9 @@ export default function () {
'res1 cookie has correct value_2': (r) => r.json().cookies.my_cookie_2 == 'hello world_2',
});
- jar.delete('https://httpbin.test.k6.io/cookies', 'my_cookie_1');
+ jar.delete('https://quickpizza.grafana.com/api/cookies', 'my_cookie_1');
- const res2 = http.get('https://httpbin.test.k6.io/cookies');
+ const res2 = http.get('https://quickpizza.grafana.com/api/cookies');
check(res2, {
'res2 has status 200': (r) => r.status === 200,
"res2 hasn't cookie 'my_cookie_1'": (r) => r.json().cookies.my_cookie_1 == null,
@@ -168,17 +168,17 @@ import { check } from 'k6';
export default function () {
const jar = http.cookieJar();
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie', 'hello world');
- const res1 = http.get('https://httpbin.test.k6.io/cookies');
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'my_cookie', 'hello world');
+ const res1 = http.get('https://quickpizza.grafana.com/api/cookies');
check(res1, {
'has status 200': (r) => r.status === 200,
"has cookie 'my_cookie'": (r) => r.json().cookies.my_cookie !== null,
'cookie has correct value': (r) => r.json().cookies.my_cookie == 'hello world',
});
- jar.clear('https://httpbin.test.k6.io/cookies');
+ jar.clear('https://quickpizza.grafana.com/api/cookies');
- const res2 = http.get('https://httpbin.test.k6.io/cookies');
+ const res2 = http.get('https://quickpizza.grafana.com/api/cookies');
check(res2, {
'has status 200': (r) => r.status === 200,
"hasn't cookie 'my_cookie'": (r) => r.json().cookies.my_cookie == null,
diff --git a/docs/sources/k6/v0.54.x/examples/correlation-and-dynamic-data.md b/docs/sources/k6/v0.54.x/examples/correlation-and-dynamic-data.md
index d5cbe1dd9f..8f51909b58 100644
--- a/docs/sources/k6/v0.54.x/examples/correlation-and-dynamic-data.md
+++ b/docs/sources/k6/v0.54.x/examples/correlation-and-dynamic-data.md
@@ -40,18 +40,23 @@ import { check } from 'k6';
export default function () {
// Make a request that returns some JSON data
- const res = http.get('https://httpbin.test.k6.io/json');
+ const reqHeaders = {
+ Authorization: 'Token abcdef0123456789',
+ };
+ const res = http.get('https://quickpizza.grafana.com/api/doughs', {
+ headers: reqHeaders,
+ });
// Extract data from that JSON data by first parsing it
// using a call to "json()" and then accessing properties by
// navigating the JSON data as a JS object with dot notation.
- const slide1 = res.json().slideshow.slides[0];
- check(slide1, {
- 'slide 1 has correct title': (s) => s.title === 'Wake up to WonderWidgets!',
- 'slide 1 has correct type': (s) => s.type === 'all',
+ const dough1 = res.json().doughs[0];
+ check(dough1, {
+ 'dough1 1 has correct name': (s) => s.name === 'Thin',
+ 'dough1 1 has correct ID': (s) => s.ID === 1,
});
- // Now we could use the "slide1" variable in subsequent requests...
+ // Now we could use the "dough1" variable in subsequent requests...
}
```
@@ -130,13 +135,13 @@ import http from 'k6/http';
export default function () {
// This request returns XML:
- const res = http.get('https://httpbin.test.k6.io/xml');
+ const res = http.get('https://quickpizza.grafana.com/api/xml?color=green');
- // Use findBetween to extract the first title encountered:
- const title = findBetween(res.body, '
', '');
+ // Use findBetween to extract the first tag encountered:
+ const color = findBetween(res.body, '', '');
- check(title, {
- 'title is correct': (t) => t === 'Wake up to WonderWidgets!',
+ check(color, {
+ 'color is correct': (t) => t === 'green',
});
}
```
diff --git a/docs/sources/k6/v0.54.x/examples/data-uploads.md b/docs/sources/k6/v0.54.x/examples/data-uploads.md
index 211cb8cc2c..f02d0b5a7b 100644
--- a/docs/sources/k6/v0.54.x/examples/data-uploads.md
+++ b/docs/sources/k6/v0.54.x/examples/data-uploads.md
@@ -128,7 +128,7 @@ export default function () {
fd.append('images', http.file(img2, 'image2.jpg', 'image/jpeg'));
fd.append('text', http.file(txt, 'text.txt', 'text/plain'));
- const res = http.post('https://httpbin.test.k6.io/post', fd.body(), {
+ const res = http.post('https://quickpizza.grafana.com/api/post', fd.body(), {
headers: { 'Content-Type': 'multipart/form-data; boundary=' + fd.boundary },
});
check(res, {
@@ -148,3 +148,5 @@ Note that:
- Blob is not supported or implemented. For the same functionality, use
a simple object with the fields `data`, `content_type` (defaulting to "application/octet-stream") and optionally
`filename` as shown for `aBinaryFile` above.
+
+
diff --git a/docs/sources/k6/v0.54.x/examples/get-timings-for-an-http-metric.md b/docs/sources/k6/v0.54.x/examples/get-timings-for-an-http-metric.md
index 03a4645836..bc30c60bca 100644
--- a/docs/sources/k6/v0.54.x/examples/get-timings-for-an-http-metric.md
+++ b/docs/sources/k6/v0.54.x/examples/get-timings-for-an-http-metric.md
@@ -27,7 +27,7 @@ This script gets the request duration timing for a specific GET request and logs
import http from 'k6/http';
export default function () {
- const res = http.get('https://httpbin.test.k6.io');
+ const res = http.get('https://quickpizza.grafana.com/');
console.log('Response time was ' + String(res.timings.duration) + ' ms');
}
```
diff --git a/docs/sources/k6/v0.54.x/examples/html-forms.md b/docs/sources/k6/v0.54.x/examples/html-forms.md
index e640c3b040..68328be1b1 100644
--- a/docs/sources/k6/v0.54.x/examples/html-forms.md
+++ b/docs/sources/k6/v0.54.x/examples/html-forms.md
@@ -18,12 +18,12 @@ import { sleep } from 'k6';
export default function () {
// Request page containing a form
- let res = http.get('https://httpbin.test.k6.io/forms/post');
+ let res = http.get('https://quickpizza.grafana.com/admin');
// Now, submit form setting/overriding some fields of the form
res = res.submitForm({
formSelector: 'form',
- fields: { custname: 'test', extradata: 'test2' },
+ fields: { username: 'admin', password: 'admin' },
});
sleep(3);
}
diff --git a/docs/sources/k6/v0.54.x/examples/http-authentication.md b/docs/sources/k6/v0.54.x/examples/http-authentication.md
index 97fb2fc24d..da8385fb9f 100644
--- a/docs/sources/k6/v0.54.x/examples/http-authentication.md
+++ b/docs/sources/k6/v0.54.x/examples/http-authentication.md
@@ -25,7 +25,7 @@ export default function () {
// Passing username and password as part of the URL will
// allow us to authenticate using HTTP Basic Auth.
- const url = `https://${credentials}@httpbin.test.k6.io/basic-auth/${username}/${password}`;
+ const url = `https://${credentials}@quickpizza.grafana.com/api/basic-auth/${username}/${password}`;
let res = http.get(url);
@@ -45,9 +45,9 @@ export default function () {
},
};
- res = http.get(`https://httpbin.test.k6.io/basic-auth/${username}/${password}`, options);
+ res = http.get(`https://quickpizza.grafana.com/api/basic-auth/${username}/${password}`, options);
- // Verify response (checking the echoed data from the httpbin.test.k6.io
+ // Verify response (checking the echoed data from the QuickPizza
// basic auth test API endpoint)
check(res, {
'status is 200': (r) => r.status === 200,
@@ -59,40 +59,6 @@ export default function () {
{{< /code >}}
-## Digest authentication
-
-{{< code >}}
-
-```javascript
-import http from 'k6/http';
-import { check } from 'k6';
-
-const username = 'user';
-const password = 'passwd';
-
-export default function () {
- // Passing username and password as part of URL plus the auth option will
- // authenticate using HTTP Digest authentication.
- const credentials = `${username}:${password}`;
- const res = http.get(
- `https://${credentials}@httpbin.test.k6.io/digest-auth/auth/${username}/${password}`,
- {
- auth: 'digest',
- }
- );
-
- // Verify response (checking the echoed data from the httpbin.test.k6.io digest auth
- // test API endpoint)
- check(res, {
- 'status is 200': (r) => r.status === 200,
- 'is authenticated': (r) => r.json().authenticated === true,
- 'is correct user': (r) => r.json().user === username,
- });
-}
-```
-
-{{< /code >}}
-
## NTLM authentication
{{< code >}}
@@ -121,6 +87,8 @@ Here's an example script to demonstrate how to sign a request to fetch an object
{{< code >}}
+
+
```javascript
import http from 'k6/http';
import {
diff --git a/docs/sources/k6/v0.54.x/get-started/resources.md b/docs/sources/k6/v0.54.x/get-started/resources.md
index ca10a8a61e..ca383da5cc 100644
--- a/docs/sources/k6/v0.54.x/get-started/resources.md
+++ b/docs/sources/k6/v0.54.x/get-started/resources.md
@@ -32,7 +32,6 @@ If you need a place to learn k6 and test your scripts, you can use these playgro
- [test-api.k6.io](https://test-api.k6.io/). A simple REST and WebSocket web application. [grafana/test-api.k6.io](https://github.com/grafana/test-api.k6.io)
- [grafana/quickpizza](https://github.com/grafana/quickpizza). A simple demo web application.
-- [grafana/httpbin](https://github.com/grafana/httpbin). A simple HTTP Request & Response Service.
Note that these are shared testing environments - please avoid high-load tests. Alternatively, you can deploy and host them on your infrastructure and run the examples in the repository.
diff --git a/docs/sources/k6/v0.54.x/get-started/running-k6.md b/docs/sources/k6/v0.54.x/get-started/running-k6.md
index 59dd258153..2b7c357283 100644
--- a/docs/sources/k6/v0.54.x/get-started/running-k6.md
+++ b/docs/sources/k6/v0.54.x/get-started/running-k6.md
@@ -180,7 +180,7 @@ export const options = {
};
export default function () {
- const res = http.get('https://httpbin.test.k6.io/');
+ const res = http.get('https://quickpizza.grafana.com/');
check(res, { 'status was 200': (r) => r.status == 200 });
sleep(1);
}
diff --git a/docs/sources/k6/v0.54.x/javascript-api/jslib/httpx/asyncrequest.md b/docs/sources/k6/v0.54.x/javascript-api/jslib/httpx/asyncrequest.md
index 1dfd7aa0de..5f1fc7a0af 100644
--- a/docs/sources/k6/v0.54.x/javascript-api/jslib/httpx/asyncrequest.md
+++ b/docs/sources/k6/v0.54.x/javascript-api/jslib/httpx/asyncrequest.md
@@ -32,7 +32,7 @@ Note, this method returns a Promise. You must use the `await` keyword to resolve
import { Httpx } from 'https://jslib.k6.io/httpx/0.1.0/index.js';
const session = new Httpx({
- baseURL: 'https://httpbin.test.k6.io',
+ baseURL: 'https://quickpizza.grafana.com/api',
timeout: 20000, // 20s timeout.
});
diff --git a/docs/sources/k6/v0.54.x/javascript-api/jslib/httpx/delete.md b/docs/sources/k6/v0.54.x/javascript-api/jslib/httpx/delete.md
index 7b1a1499d9..5a21e413dc 100644
--- a/docs/sources/k6/v0.54.x/javascript-api/jslib/httpx/delete.md
+++ b/docs/sources/k6/v0.54.x/javascript-api/jslib/httpx/delete.md
@@ -29,7 +29,7 @@ weight: 14
import { Httpx } from 'https://jslib.k6.io/httpx/0.1.0/index.js';
const session = new Httpx({
- baseURL: 'https://httpbin.test.k6.io',
+ baseURL: 'https://quickpizza.grafana.com/api',
timeout: 20000, // 20s timeout.
});
diff --git a/docs/sources/k6/v0.54.x/javascript-api/jslib/httpx/head.md b/docs/sources/k6/v0.54.x/javascript-api/jslib/httpx/head.md
index 7cf0661111..74186e5c7e 100644
--- a/docs/sources/k6/v0.54.x/javascript-api/jslib/httpx/head.md
+++ b/docs/sources/k6/v0.54.x/javascript-api/jslib/httpx/head.md
@@ -29,12 +29,12 @@ weight: 16
import { Httpx } from 'https://jslib.k6.io/httpx/0.1.0/index.js';
const session = new Httpx({
- baseURL: 'https://httpbin.test.k6.io',
+ baseURL: 'https://quickpizza.grafana.com',
timeout: 20000, // 20s timeout.
});
export default function testSuite() {
- const resp = session.head(`/head`);
+ const resp = session.head(`/`);
console.log(resp.status);
}
```
diff --git a/docs/sources/k6/v0.54.x/javascript-api/jslib/httpx/options.md b/docs/sources/k6/v0.54.x/javascript-api/jslib/httpx/options.md
index d7310722aa..ed37f4f73a 100644
--- a/docs/sources/k6/v0.54.x/javascript-api/jslib/httpx/options.md
+++ b/docs/sources/k6/v0.54.x/javascript-api/jslib/httpx/options.md
@@ -29,12 +29,12 @@ weight: 15
import { Httpx } from 'https://jslib.k6.io/httpx/0.1.0/index.js';
const session = new Httpx({
- baseURL: 'https://httpbin.test.k6.io',
+ baseURL: 'https://quickpizza.grafana.com',
timeout: 20000, // 20s timeout.
});
export default function testSuite() {
- const resp = session.options(`/options`);
+ const resp = session.options(`/`);
console.log(resp.status);
}
```
diff --git a/docs/sources/k6/v0.54.x/javascript-api/jslib/httpx/patch.md b/docs/sources/k6/v0.54.x/javascript-api/jslib/httpx/patch.md
index c21488464f..29acadd260 100644
--- a/docs/sources/k6/v0.54.x/javascript-api/jslib/httpx/patch.md
+++ b/docs/sources/k6/v0.54.x/javascript-api/jslib/httpx/patch.md
@@ -30,7 +30,7 @@ weight: 13
import { Httpx } from 'https://jslib.k6.io/httpx/0.1.0/index.js';
const session = new Httpx({
- baseURL: 'https://httpbin.test.k6.io',
+ baseURL: 'https://quickpizza.grafana.com/api',
timeout: 20000, // 20s timeout.
});
diff --git a/docs/sources/k6/v0.54.x/javascript-api/jslib/httpx/put.md b/docs/sources/k6/v0.54.x/javascript-api/jslib/httpx/put.md
index b865d55225..2c519079ee 100644
--- a/docs/sources/k6/v0.54.x/javascript-api/jslib/httpx/put.md
+++ b/docs/sources/k6/v0.54.x/javascript-api/jslib/httpx/put.md
@@ -30,7 +30,7 @@ weight: 12
import { Httpx } from 'https://jslib.k6.io/httpx/0.1.0/index.js';
const session = new Httpx({
- baseURL: 'https://httpbin.test.k6.io',
+ baseURL: 'https://quickpizza.grafana.com/api',
timeout: 20000, // 20s timeout.
});
diff --git a/docs/sources/k6/v0.54.x/javascript-api/jslib/httpx/request.md b/docs/sources/k6/v0.54.x/javascript-api/jslib/httpx/request.md
index 774fc143b3..ec051467a1 100644
--- a/docs/sources/k6/v0.54.x/javascript-api/jslib/httpx/request.md
+++ b/docs/sources/k6/v0.54.x/javascript-api/jslib/httpx/request.md
@@ -33,7 +33,7 @@ Consider using specific methods for making common requests [get](https://grafana
import { Httpx } from 'https://jslib.k6.io/httpx/0.1.0/index.js';
const session = new Httpx({
- baseURL: 'https://httpbin.test.k6.io',
+ baseURL: 'https://quickpizza.grafana.com/api',
timeout: 20000, // 20s timeout.
});
diff --git a/docs/sources/k6/v0.54.x/javascript-api/jslib/httpx/trace.md b/docs/sources/k6/v0.54.x/javascript-api/jslib/httpx/trace.md
index 6057a953f6..5b396c4890 100644
--- a/docs/sources/k6/v0.54.x/javascript-api/jslib/httpx/trace.md
+++ b/docs/sources/k6/v0.54.x/javascript-api/jslib/httpx/trace.md
@@ -29,12 +29,12 @@ weight: 17
import { Httpx } from 'https://jslib.k6.io/httpx/0.1.0/index.js';
const session = new Httpx({
- baseURL: 'https://httpbin.test.k6.io',
+ baseURL: 'https://quickpizza.grafana.com',
timeout: 20000, // 20s timeout.
});
export default function testSuite() {
- const resp = session.trace(`/trace`);
+ const resp = session.trace(`/`);
console.log(resp.status);
}
```
diff --git a/docs/sources/k6/v0.54.x/javascript-api/jslib/utils/check.md b/docs/sources/k6/v0.54.x/javascript-api/jslib/utils/check.md
index 3ddb2fbc85..e3f09eb02f 100644
--- a/docs/sources/k6/v0.54.x/javascript-api/jslib/utils/check.md
+++ b/docs/sources/k6/v0.54.x/javascript-api/jslib/utils/check.md
@@ -39,7 +39,7 @@ function waitFor(delay) {
}
export default async function () {
- const res = http.get('https://httpbin.test.k6.io');
+ const res = http.get('https://quickpizza.grafana.com/');
const success = await check(res, {
'passing promise as a value': waitFor(1000),
diff --git a/docs/sources/k6/v0.54.x/javascript-api/k6-browser/browsercontext/setdefaultnavigationtimeout.md b/docs/sources/k6/v0.54.x/javascript-api/k6-browser/browsercontext/setdefaultnavigationtimeout.md
index ed1d41d63d..dd763ce1da 100644
--- a/docs/sources/k6/v0.54.x/javascript-api/k6-browser/browsercontext/setdefaultnavigationtimeout.md
+++ b/docs/sources/k6/v0.54.x/javascript-api/k6-browser/browsercontext/setdefaultnavigationtimeout.md
@@ -15,6 +15,8 @@ Sets the default maximum navigation timeout for [Page.goto()](https://grafana.co
{{< code >}}
+
+
```javascript
import { browser } from 'k6/browser';
@@ -37,7 +39,7 @@ export default async function () {
context.setDefaultNavigationTimeout(1000); // 1s
try {
- await page.goto('https://httpbin.test.k6.io/delay/5');
+ await page.goto('https://quickpizza.grafana.com/api/delay/5');
} finally {
await page.close();
}
diff --git a/docs/sources/k6/v0.54.x/javascript-api/k6-browser/response/json.md b/docs/sources/k6/v0.54.x/javascript-api/k6-browser/response/json.md
index 1c1aaa66c1..ecd7adea9d 100644
--- a/docs/sources/k6/v0.54.x/javascript-api/k6-browser/response/json.md
+++ b/docs/sources/k6/v0.54.x/javascript-api/k6-browser/response/json.md
@@ -37,10 +37,10 @@ export default async function () {
const page = await browser.newPage();
try {
- const res = await page.goto('https://httpbin.test.k6.io/json');
+ const res = await page.goto('https://quickpizza.grafana.com/api/json?foo=bar');
const json = await res.json();
- console.log(`json: ${JSON.stringify(json)}`); // json: {"slideshow":
+ console.log(`json: ${JSON.stringify(json)}`); // json: {"foo": "bar"}
} finally {
await page.close();
}
diff --git a/docs/sources/k6/v0.54.x/javascript-api/k6-data/sharedarray.md b/docs/sources/k6/v0.54.x/javascript-api/k6-data/sharedarray.md
index 5750ac52f5..4d1e00d48d 100644
--- a/docs/sources/k6/v0.54.x/javascript-api/k6-data/sharedarray.md
+++ b/docs/sources/k6/v0.54.x/javascript-api/k6-data/sharedarray.md
@@ -13,6 +13,8 @@ When a script requests an element, k6 gives a _copy_ of that element.
You must construct a `SharedArray` in the [`init` context](https://grafana.com/docs/k6//using-k6/test-lifecycle).
Its constructor takes a name for the `SharedArray` and a function that needs to return an array object itself:
+
+
```javascript
import { SharedArray } from 'k6/data';
@@ -49,6 +51,8 @@ This limitation will eventually be removed, but for now, the implication is that
{{< code >}}
+
+
```javascript
import { SharedArray } from 'k6/data';
@@ -79,6 +83,8 @@ To test this, we ran the following script on version v0.31.0 with 100 VUs.
{{< code >}}
+
+
```javascript
import { check } from 'k6';
import http from 'k6/http';
@@ -102,7 +108,7 @@ if (__ENV.SHARED === 'true') {
export default function () {
const iterationData = data[Math.floor(Math.random() * data.length)];
- const res = http.post('https://httpbin.test.k6.io/anything', JSON.stringify(iterationData), {
+ const res = http.post('https://quickpizza.grafana.com/api/post', JSON.stringify(iterationData), {
headers: { 'Content-type': 'application/json' },
});
check(res, { 'status 200': (r) => r.status === 200 });
diff --git a/docs/sources/k6/v0.54.x/javascript-api/k6-http/asyncrequest.md b/docs/sources/k6/v0.54.x/javascript-api/k6-http/asyncrequest.md
index 8b8ddf6d20..6734c97171 100644
--- a/docs/sources/k6/v0.54.x/javascript-api/k6-http/asyncrequest.md
+++ b/docs/sources/k6/v0.54.x/javascript-api/k6-http/asyncrequest.md
@@ -29,21 +29,20 @@ Using http.asyncRequest() to issue a POST request:
```javascript
import http from 'k6/http';
-const url = 'https://httpbin.test.k6.io/post';
+const url = 'https://quickpizza.grafana.com/api/post';
export default async function () {
const data = { name: 'Bert' };
// Using a JSON string as body
- let res = await http.asyncRequest('POST', url, JSON.stringify(data), {
+ const res = await http.asyncRequest('POST', url, JSON.stringify(data), {
headers: { 'Content-Type': 'application/json' },
});
- console.log(res.json().json.name); // Bert
+ console.log(res.json().name); // Bert
// Using an object as body, the headers will automatically include
// 'Content-Type: application/x-www-form-urlencoded'.
- res = await http.asyncRequest('POST', url, data);
- console.log(res.json().form.name); // Bert
+ await http.asyncRequest('POST', url, data);
}
```
@@ -57,9 +56,9 @@ Using `http.asyncRequest()` to issue multiple requests, then [Promise.race](http
import http from 'k6/http';
export default async () => {
- const urlOne = `https://httpbin.test.k6.io/delay/${randomInt(1, 5)}`;
- const urlTwo = `https://httpbin.test.k6.io/delay/${randomInt(1, 5)}`;
- const urlThree = `https://httpbin.test.k6.io/delay/${randomInt(1, 5)}`;
+ const urlOne = `https://quickpizza.grafana.com/api/delay/${randomInt(1, 5)}`;
+ const urlTwo = `https://quickpizza.grafana.com/api/delay/${randomInt(1, 5)}`;
+ const urlThree = `https://quickpizza.grafana.com/api/delay/${randomInt(1, 5)}`;
const one = http.asyncRequest('GET', urlOne);
const two = http.asyncRequest('GET', urlTwo);
diff --git a/docs/sources/k6/v0.54.x/javascript-api/k6-http/batch.md b/docs/sources/k6/v0.54.x/javascript-api/k6-http/batch.md
index a0d9ec5f29..752d898566 100644
--- a/docs/sources/k6/v0.54.x/javascript-api/k6-http/batch.md
+++ b/docs/sources/k6/v0.54.x/javascript-api/k6-http/batch.md
@@ -91,27 +91,25 @@ import { check } from 'k6';
export default function () {
const req1 = {
method: 'GET',
- url: 'https://httpbin.test.k6.io/get',
+ url: 'https://quickpizza.grafana.com/api/get',
};
const req2 = {
- method: 'GET',
- url: 'https://test.k6.io',
+ method: 'DELETE',
+ url: 'https://quickpizza.grafana.com/api/delete',
};
const req3 = {
method: 'POST',
- url: 'https://httpbin.test.k6.io/post',
- body: {
- hello: 'world!',
- },
+ url: 'https://quickpizza.grafana.com/api/post',
+ body: JSON.stringify({ hello: 'world!' }),
params: {
- headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
+ headers: { 'Content-Type': 'application/json' },
},
};
const responses = http.batch([req1, req2, req3]);
- // httpbin.test.k6.io should return our POST data in the response body, so
+ // QuickPizza should return our POST data in the response body, so
// we check the third response object to see that the POST worked.
check(responses[2], {
- 'form data OK': (res) => JSON.parse(res.body)['form']['hello'] == 'world!',
+ 'form data OK': (res) => JSON.parse(res.body)['hello'] == 'world!',
});
}
```
diff --git a/docs/sources/k6/v0.54.x/javascript-api/k6-http/cookiejar/_index.md b/docs/sources/k6/v0.54.x/javascript-api/k6-http/cookiejar/_index.md
index cb001cf382..616e58b8a6 100644
--- a/docs/sources/k6/v0.54.x/javascript-api/k6-http/cookiejar/_index.md
+++ b/docs/sources/k6/v0.54.x/javascript-api/k6-http/cookiejar/_index.md
@@ -22,19 +22,19 @@ import http from 'k6/http';
import { check } from 'k6';
export default function () {
- const res1 = http.get('https://httpbin.test.k6.io/cookies/set?my_cookie=hello%20world', {
+ const res1 = http.post('https://quickpizza.grafana.com/api/cookies?my_cookie=hello%20world', {
redirects: 0,
});
const jar = http.cookieJar();
- const cookies = jar.cookiesForURL('https://httpbin.test.k6.io/');
+ const cookies = jar.cookiesForURL('https://quickpizza.grafana.com/api/cookies');
check(res1, {
"has cookie 'my_cookie'": (r) => cookies.my_cookie.length > 0,
'cookie has correct value': (r) => cookies.my_cookie[0] === 'hello world',
});
- jar.clear('https://httpbin.test.k6.io/cookies');
+ jar.clear('https://quickpizza.grafana.com/api/cookies');
- const res2 = http.get('https://httpbin.test.k6.io/cookies');
+ const res2 = http.get('https://quickpizza.grafana.com/api/cookies');
check(res2, {
'has status 200': (r) => r.status === 200,
"hasn't cookie 'my_cookie'": (r) => r.json().cookies.my_cookie == null,
diff --git a/docs/sources/k6/v0.54.x/javascript-api/k6-http/cookiejar/cookiejar-clear.md b/docs/sources/k6/v0.54.x/javascript-api/k6-http/cookiejar/cookiejar-clear.md
index b0dcc88b01..ca8f0315a2 100644
--- a/docs/sources/k6/v0.54.x/javascript-api/k6-http/cookiejar/cookiejar-clear.md
+++ b/docs/sources/k6/v0.54.x/javascript-api/k6-http/cookiejar/cookiejar-clear.md
@@ -17,29 +17,29 @@ description: 'Delete all cookies for the given URL.'
import http from 'k6/http';
export default function () {
- http.get('https://httpbin.test.k6.io/cookies/set?one=1&two=2');
+ http.post('https://quickpizza.grafana.com/api/cookies?one=1&two=2');
- // We'll use httpbin's reflection to see what cookies we
+ // We'll use QuickPizza's cookie reflection to see what cookies we
// are actually sending to the server after every change
- let httpbinResp;
- httpbinResp = http.get('https://httpbin.test.k6.io/cookies');
- console.log(JSON.stringify(httpbinResp.json().cookies));
+ let qpResp;
+ qpResp = http.get('https://quickpizza.grafana.com/api/cookies');
+ console.log(JSON.stringify(qpResp.json().cookies));
// Will print '{"one":"1","two":"2"}'
const jar = http.cookieJar(); // get the VU specific jar
- jar.set('https://httpbin.test.k6.io/cookies', 'three', '3');
- httpbinResp = http.get('https://httpbin.test.k6.io/cookies');
- console.log(JSON.stringify(httpbinResp.json().cookies));
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'three', '3');
+ qpResp = http.get('https://quickpizza.grafana.com/api/cookies');
+ console.log(JSON.stringify(qpResp.json().cookies));
// Will print '{"one":"1","three":"3","two":"2"}'
- jar.delete('https://httpbin.test.k6.io/cookies', 'one');
- httpbinResp = http.get('https://httpbin.test.k6.io/cookies');
- console.log(JSON.stringify(httpbinResp.json().cookies));
+ jar.delete('https://quickpizza.grafana.com/api/cookies', 'one');
+ qpResp = http.get('https://quickpizza.grafana.com/api/cookies');
+ console.log(JSON.stringify(qpResp.json().cookies));
// Will print '{"three":"3","two":"2"}'
- jar.clear('https://httpbin.test.k6.io/cookies');
- httpbinResp = http.get('https://httpbin.test.k6.io/cookies');
- console.log(JSON.stringify(httpbinResp.json().cookies));
+ jar.clear('https://quickpizza.grafana.com/api/cookies');
+ qpResp = http.get('https://quickpizza.grafana.com/api/cookies');
+ console.log(JSON.stringify(qpResp.json().cookies));
// Will print '{}'
}
```
diff --git a/docs/sources/k6/v0.54.x/javascript-api/k6-http/cookiejar/cookiejar-cookiesforurl.md b/docs/sources/k6/v0.54.x/javascript-api/k6-http/cookiejar/cookiejar-cookiesforurl.md
index 533a0ad038..3f058e0112 100644
--- a/docs/sources/k6/v0.54.x/javascript-api/k6-http/cookiejar/cookiejar-cookiesforurl.md
+++ b/docs/sources/k6/v0.54.x/javascript-api/k6-http/cookiejar/cookiejar-cookiesforurl.md
@@ -24,11 +24,11 @@ import http from 'k6/http';
import { check } from 'k6';
export default function () {
- const res = http.get('https://httpbin.test.k6.io/cookies/set?my_cookie=hello%20world', {
+ const res = http.post('https://quickpizza.grafana.com/api/cookies?my_cookie=hello%20world', {
redirects: 0,
});
const jar = http.cookieJar();
- const cookies = jar.cookiesForURL('https://httpbin.test.k6.io/');
+ const cookies = jar.cookiesForURL('https://quickpizza.grafana.com/api/cookies');
check(res, {
"has cookie 'my_cookie'": (r) => cookies.my_cookie.length > 0,
'cookie has correct value': (r) => cookies.my_cookie[0] === 'hello world',
diff --git a/docs/sources/k6/v0.54.x/javascript-api/k6-http/cookiejar/cookiejar-delete.md b/docs/sources/k6/v0.54.x/javascript-api/k6-http/cookiejar/cookiejar-delete.md
index 558dc1c24d..932f3d3238 100644
--- a/docs/sources/k6/v0.54.x/javascript-api/k6-http/cookiejar/cookiejar-delete.md
+++ b/docs/sources/k6/v0.54.x/javascript-api/k6-http/cookiejar/cookiejar-delete.md
@@ -20,10 +20,10 @@ import { check } from 'k6';
export default function () {
const jar = http.cookieJar();
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie_1', 'hello world_1');
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie_2', 'hello world_2');
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'my_cookie_1', 'hello world_1');
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'my_cookie_2', 'hello world_2');
- const res1 = http.get('https://httpbin.test.k6.io/cookies');
+ const res1 = http.get('https://quickpizza.grafana.com/api/cookies');
check(res1, {
'res1 has status 200': (r) => r.status === 200,
"res1 has cookie 'my_cookie_1'": (r) => r.json().cookies.my_cookie_1 !== null,
@@ -32,9 +32,9 @@ export default function () {
'res1 cookie has correct value_2': (r) => r.json().cookies.my_cookie_2 == 'hello world_2',
});
- jar.delete('https://httpbin.test.k6.io/cookies', 'my_cookie_1');
+ jar.delete('https://quickpizza.grafana.com/api/cookies', 'my_cookie_1');
- const res2 = http.get('https://httpbin.test.k6.io/cookies');
+ const res2 = http.get('https://quickpizza.grafana.com/api/cookies');
check(res2, {
'res2 has status 200': (r) => r.status === 200,
"res2 doesn't have cookie 'my_cookie_1'": (r) => r.json().cookies.my_cookie_1 == null,
diff --git a/docs/sources/k6/v0.54.x/javascript-api/k6-http/cookiejar/cookiejar-set.md b/docs/sources/k6/v0.54.x/javascript-api/k6-http/cookiejar/cookiejar-set.md
index 170fb114ae..6f1de5a28f 100644
--- a/docs/sources/k6/v0.54.x/javascript-api/k6-http/cookiejar/cookiejar-set.md
+++ b/docs/sources/k6/v0.54.x/javascript-api/k6-http/cookiejar/cookiejar-set.md
@@ -24,13 +24,14 @@ import { check } from 'k6';
export default function () {
const jar = http.cookieJar();
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie', 'hello world', {
- domain: 'httpbin.test.k6.io',
- path: '/cookies',
+ jar.set('http://quickpizza.grafana.com', 'my_cookie', 'hello world', {
+ domain: 'quickpizza.grafana.com',
+ path: '/api/cookies',
secure: true,
max_age: 600,
});
- const res = http.get('https://httpbin.test.k6.io/cookies');
+ const res = http.get('https://quickpizza.grafana.com/api/cookies');
+ console.log(res.body);
check(res, {
'has status 200': (r) => r.status === 200,
"has cookie 'my_cookie'": (r) => r.json().cookies.my_cookie !== null,
diff --git a/docs/sources/k6/v0.54.x/javascript-api/k6-http/del.md b/docs/sources/k6/v0.54.x/javascript-api/k6-http/del.md
index 8a2327025c..b02862e82a 100644
--- a/docs/sources/k6/v0.54.x/javascript-api/k6-http/del.md
+++ b/docs/sources/k6/v0.54.x/javascript-api/k6-http/del.md
@@ -28,7 +28,7 @@ Make a DELETE request.
```javascript
import http from 'k6/http';
-const url = 'https://httpbin.test.k6.io/delete';
+const url = 'https://quickpizza.grafana.com/api/delete';
export default function () {
const params = { headers: { 'X-MyHeader': 'k6test' } };
diff --git a/docs/sources/k6/v0.54.x/javascript-api/k6-http/expected-statuses.md b/docs/sources/k6/v0.54.x/javascript-api/k6-http/expected-statuses.md
index 4912667f2e..d983b1098c 100644
--- a/docs/sources/k6/v0.54.x/javascript-api/k6-http/expected-statuses.md
+++ b/docs/sources/k6/v0.54.x/javascript-api/k6-http/expected-statuses.md
@@ -30,7 +30,7 @@ http.setResponseCallback(
export default () => {
// this one will actually be marked as failed as it doesn't match any of the above listed status
// codes
- http.get('https://httpbin.test.k6.io/status/205');
+ http.get('https://quickpizza.grafana.com/api/status/205');
};
```
diff --git a/docs/sources/k6/v0.54.x/javascript-api/k6-http/options.md b/docs/sources/k6/v0.54.x/javascript-api/k6-http/options.md
index bfe15af36b..6d7d78bfa1 100644
--- a/docs/sources/k6/v0.54.x/javascript-api/k6-http/options.md
+++ b/docs/sources/k6/v0.54.x/javascript-api/k6-http/options.md
@@ -26,7 +26,7 @@ weight: 10
```javascript
import http from 'k6/http';
-const url = 'https://httpbin.test.k6.io/';
+const url = 'https://quickpizza.grafana.com/';
export default function () {
const params = { headers: { 'X-MyHeader': 'k6test' } };
diff --git a/docs/sources/k6/v0.54.x/javascript-api/k6-http/params.md b/docs/sources/k6/v0.54.x/javascript-api/k6-http/params.md
index 122dabf05c..f8ead90919 100644
--- a/docs/sources/k6/v0.54.x/javascript-api/k6-http/params.md
+++ b/docs/sources/k6/v0.54.x/javascript-api/k6-http/params.md
@@ -53,8 +53,8 @@ Here is another example using [http.batch()](https://grafana.com/docs/k6/}}
-### Example of Digest Authentication
-
-Here is one example of how to use the `Params` to Digest Authentication.
-
-{{< code >}}
-
-```javascript
-import http from 'k6/http';
-import { check } from 'k6';
-
-export default function () {
- // Passing username and password as part of URL plus the auth option will authenticate using HTTP Digest authentication
- const res = http.get('http://user:passwd@httpbin.test.k6.io/digest-auth/auth/user/passwd', {
- auth: 'digest',
- });
-
- // Verify response
- check(res, {
- 'status is 200': (r) => r.status === 200,
- 'is authenticated': (r) => r.json().authenticated === true,
- 'is correct user': (r) => r.json().user === 'user',
- });
-}
-```
-
-{{< /code >}}
-
### Example of overriding discardResponseBodies
{{< code >}}
@@ -110,7 +83,7 @@ export default function () {}
export function setup() {
// Get 10 random bytes as an ArrayBuffer. Without the responseType the body
// will be null.
- const response = http.get('https://httpbin.test.k6.io/bytes/10', {
+ const response = http.get('https://quickpizza.grafana.com/api/bytes/10', {
responseType: 'binary',
});
// response.body is an ArrayBuffer, so wrap it in a typed array view to access
diff --git a/docs/sources/k6/v0.54.x/javascript-api/k6-http/patch.md b/docs/sources/k6/v0.54.x/javascript-api/k6-http/patch.md
index 81de685c9c..ec1cd71b1f 100644
--- a/docs/sources/k6/v0.54.x/javascript-api/k6-http/patch.md
+++ b/docs/sources/k6/v0.54.x/javascript-api/k6-http/patch.md
@@ -26,7 +26,7 @@ weight: 10
```javascript
import http from 'k6/http';
-const url = 'https://httpbin.test.k6.io/patch';
+const url = 'https://quickpizza.grafana.com/api/patch';
export default function () {
const headers = { 'Content-Type': 'application/json' };
@@ -34,7 +34,7 @@ export default function () {
const res = http.patch(url, JSON.stringify(data), { headers: headers });
- console.log(JSON.parse(res.body).json.name);
+ console.log(JSON.parse(res.body).name);
}
```
diff --git a/docs/sources/k6/v0.54.x/javascript-api/k6-http/post.md b/docs/sources/k6/v0.54.x/javascript-api/k6-http/post.md
index 2f1dfb0dfb..77fe3c8df0 100644
--- a/docs/sources/k6/v0.54.x/javascript-api/k6-http/post.md
+++ b/docs/sources/k6/v0.54.x/javascript-api/k6-http/post.md
@@ -23,10 +23,12 @@ weight: 10
{{< code >}}
+
+
```javascript
import http from 'k6/http';
-const url = 'https://httpbin.test.k6.io/post';
+const url = 'https://quickpizza.grafana.com/api/json';
const logoBin = open('./logo.png', 'b');
export default function () {
diff --git a/docs/sources/k6/v0.54.x/javascript-api/k6-http/put.md b/docs/sources/k6/v0.54.x/javascript-api/k6-http/put.md
index 5b5f2a7653..9d26cbda82 100644
--- a/docs/sources/k6/v0.54.x/javascript-api/k6-http/put.md
+++ b/docs/sources/k6/v0.54.x/javascript-api/k6-http/put.md
@@ -26,7 +26,7 @@ weight: 10
```javascript
import http from 'k6/http';
-const url = 'https://httpbin.test.k6.io/put';
+const url = 'https://quickpizza.grafana.com/api/put';
export default function () {
const headers = { 'Content-Type': 'application/json' };
@@ -34,7 +34,7 @@ export default function () {
const res = http.put(url, JSON.stringify(data), { headers: headers });
- console.log(JSON.parse(res.body).json.name);
+ console.log(JSON.parse(res.body).name);
}
```
diff --git a/docs/sources/k6/v0.54.x/javascript-api/k6-http/request.md b/docs/sources/k6/v0.54.x/javascript-api/k6-http/request.md
index 4766ae22bb..b541bf2997 100644
--- a/docs/sources/k6/v0.54.x/javascript-api/k6-http/request.md
+++ b/docs/sources/k6/v0.54.x/javascript-api/k6-http/request.md
@@ -29,7 +29,7 @@ Using http.request() to issue a POST request:
```javascript
import http from 'k6/http';
-const url = 'https://httpbin.test.k6.io/post';
+const url = 'https://quickpizza.grafana.com/api/post';
export default function () {
const data = { name: 'Bert' };
@@ -38,12 +38,12 @@ export default function () {
let res = http.request('POST', url, JSON.stringify(data), {
headers: { 'Content-Type': 'application/json' },
});
- console.log(res.json().json.name); // Bert
+ console.log(res.json().name); // Bert
// Using an object as body, the headers will automatically include
// 'Content-Type: application/x-www-form-urlencoded'.
res = http.request('POST', url, data);
- console.log(res.json().form.name); // Bert
+ console.log(res.body); // name=Bert
}
```
diff --git a/docs/sources/k6/v0.54.x/javascript-api/k6-http/response/response-clicklink---params.md b/docs/sources/k6/v0.54.x/javascript-api/k6-http/response/response-clicklink---params.md
index 1f9ac592c4..e0d55694b2 100644
--- a/docs/sources/k6/v0.54.x/javascript-api/k6-http/response/response-clicklink---params.md
+++ b/docs/sources/k6/v0.54.x/javascript-api/k6-http/response/response-clicklink---params.md
@@ -30,10 +30,10 @@ import http from 'k6/http';
export default function () {
// Request page with links
- let res = http.get('https://httpbin.test.k6.io/links/10/0');
+ let res = http.get('https://quickpizza.grafana.com/admin');
// Now, click the 4th link on the page
- res = res.clickLink({ selector: 'a:nth-child(4)' });
+ res = res.clickLink({ selector: 'a:nth-child(1)' });
}
```
diff --git a/docs/sources/k6/v0.54.x/javascript-api/k6-http/response/response-submitform---params.md b/docs/sources/k6/v0.54.x/javascript-api/k6-http/response/response-submitform---params.md
index f482b034b5..a71b4d590a 100644
--- a/docs/sources/k6/v0.54.x/javascript-api/k6-http/response/response-submitform---params.md
+++ b/docs/sources/k6/v0.54.x/javascript-api/k6-http/response/response-submitform---params.md
@@ -33,12 +33,12 @@ import { sleep } from 'k6';
export default function () {
// Request page containing a form
- let res = http.get('https://httpbin.test.k6.io/forms/post');
+ let res = http.get('https://quickpizza.grafana.com/admin');
// Now, submit form setting/overriding some fields of the form
res = res.submitForm({
formSelector: 'form',
- fields: { custname: 'test', extradata: 'test2' },
+ fields: { username: 'test', password: 'test2' },
});
sleep(3);
}
diff --git a/docs/sources/k6/v0.54.x/javascript-api/k6-http/set-response-callback.md b/docs/sources/k6/v0.54.x/javascript-api/k6-http/set-response-callback.md
index 9a62e2d2eb..98407b94b3 100644
--- a/docs/sources/k6/v0.54.x/javascript-api/k6-http/set-response-callback.md
+++ b/docs/sources/k6/v0.54.x/javascript-api/k6-http/set-response-callback.md
@@ -41,10 +41,12 @@ const only300Callback = http.expectedStatuses(300);
export default () => {
// this will use the default response callback and be marked as successful
- http.get('https://httpbin.test.k6.io/status/200');
+ http.get('https://quickpizza.grafana.com/api/status/200');
// this will be marked as a failed request as it won't get the expected status code of 300
- http.get('https://httpbin.test.k6.io/status/200', { responseCallback: only300Callback });
+ http.get('https://quickpizza.grafana.com/api/status/200', {
+ responseCallback: only300Callback,
+ });
http.setResponseCallback(http.expectedStatuses(301));
// from here on for this VU only the 301 status code will be successful so on the next iteration of
diff --git a/docs/sources/k6/v0.54.x/javascript-api/k6/check.md b/docs/sources/k6/v0.54.x/javascript-api/k6/check.md
index 5a155583dc..4bf25a6b15 100644
--- a/docs/sources/k6/v0.54.x/javascript-api/k6/check.md
+++ b/docs/sources/k6/v0.54.x/javascript-api/k6/check.md
@@ -37,7 +37,7 @@ import http from 'k6/http';
import { check } from 'k6';
export default function () {
- const res = http.get('https://httpbin.test.k6.io');
+ const res = http.get('https://quickpizza.grafana.com/');
check(res, {
'response code was 200': (res) => res.status == 200,
});
@@ -55,12 +55,12 @@ import http from 'k6/http';
import { check, fail } from 'k6';
export default function () {
- const res = http.get('https://httpbin.test.k6.io');
+ const res = http.get('https://quickpizza.grafana.com/');
const checkOutput = check(
res,
{
'response code was 200': (res) => res.status == 200,
- 'body size was 1234 bytes': (res) => res.body.length == 1234,
+ 'body size was larger than 123 bytes': (res) => res.body.length > 123,
},
{ myTag: "I'm a tag" }
);
diff --git a/docs/sources/k6/v0.54.x/results-output/end-of-test/custom-summary.md b/docs/sources/k6/v0.54.x/results-output/end-of-test/custom-summary.md
index 8fe1078075..b402364bba 100644
--- a/docs/sources/k6/v0.54.x/results-output/end-of-test/custom-summary.md
+++ b/docs/sources/k6/v0.54.x/results-output/end-of-test/custom-summary.md
@@ -217,6 +217,8 @@ The output is a short XML file that reports whether the test thresholds failed.
{{< code >}}
+
+
```javascript
import http from 'k6/http';
@@ -260,6 +262,8 @@ You can also send the generated reports to a remote server (over any protocol th
{{< code >}}
+
+
```javascript
import http from 'k6/http';
@@ -271,7 +275,7 @@ export function handleSummary(data) {
console.log('Preparing the end-of-test summary...');
// Send the results to some remote server or trigger a hook
- const resp = http.post('https://httpbin.test.k6.io/anything', JSON.stringify(data));
+ const resp = http.post('https://quickpizza.grafana.com/api/post', JSON.stringify(data));
if (resp.status != 200) {
console.error('Could not send summary, got status ' + resp.status);
}
diff --git a/docs/sources/k6/v0.54.x/results-output/real-time/json.md b/docs/sources/k6/v0.54.x/results-output/real-time/json.md
index 1febba1a6c..8b337be42d 100644
--- a/docs/sources/k6/v0.54.x/results-output/real-time/json.md
+++ b/docs/sources/k6/v0.54.x/results-output/real-time/json.md
@@ -62,7 +62,7 @@ The JSON output has lines as follows:
{"type":"Metric","data":{"type":"gauge","contains":"default","tainted":null,"thresholds":[],"submetrics":null},"metric":"vus"}
{"type":"Point","data":{"time":"2017-05-09T14:34:45.625742514+02:00","value":5,"tags":null},"metric":"vus"}
{"type":"Metric","data":{"type":"trend","contains":"time","tainted":null,"thresholds":["avg<1000"],"submetrics":null},"metric":"http_req_duration"}
-{"type":"Point","data":{"time":"2017-05-09T14:34:45.239531499+02:00","value":459.865729,"tags":{"group":"::my group::json","method":"GET","status":"200","url":"https://httpbin.test.k6.io/get"}},"metric":"http_req_duration"}
+{"type":"Point","data":{"time":"2017-05-09T14:34:45.239531499+02:00","value":459.865729,"tags":{"group":"::my group::json","method":"GET","status":"200","url":"https://quickpizza.grafana.com/api/tools"}},"metric":"http_req_duration"}
```
{{< /code >}}
diff --git a/docs/sources/k6/v0.54.x/testing-guides/api-load-testing.md b/docs/sources/k6/v0.54.x/testing-guides/api-load-testing.md
index 91ca308f90..b5dba6e323 100644
--- a/docs/sources/k6/v0.54.x/testing-guides/api-load-testing.md
+++ b/docs/sources/k6/v0.54.x/testing-guides/api-load-testing.md
@@ -43,7 +43,7 @@ export default function () {
surname: 'ipsum',
});
const headers = { 'Content-Type': 'application/json' };
- http.post('https://httpbin.test.k6.io/post', payload, { headers });
+ http.post('https://quickpizza.grafana.com/api/post', payload, { headers });
}
```
@@ -133,7 +133,7 @@ export default function () {
surname: 'ipsum',
});
const headers = { 'Content-Type': 'application/json' };
- http.post('https://httpbin.test.k6.io/post', payload, { headers });
+ http.post('https://quickpizza.grafana.com/api/post', payload, { headers });
}
```
@@ -181,7 +181,7 @@ export default function () {
surname: 'ipsum',
});
const headers = { 'Content-Type': 'application/json' };
- http.post('https://httpbin.test.k6.io/post', payload, { headers });
+ http.post('https://quickpizza.grafana.com/api/post', payload, { headers });
}
```
@@ -256,12 +256,12 @@ export default function () {
surname: 'ipsum',
});
const headers = { 'Content-Type': 'application/json' };
- const res = http.post('https://httpbin.test.k6.io/post', payload, { headers });
+ const res = http.post('https://quickpizza.grafana.com/api/post', payload, { headers });
check(res, {
'Post status is 200': (r) => res.status === 200,
'Post Content-Type header': (r) => res.headers['Content-Type'] === 'application/json',
- 'Post response name': (r) => res.status === 200 && res.json().json.name === 'lorem',
+ 'Post response name': (r) => res.status === 200 && res.json().name === 'lorem',
});
}
```
@@ -310,6 +310,8 @@ To ensure your system achieves its SLOs, test them frequently, both in pre-produ
In k6, you can use [Thresholds](https://grafana.com/docs/k6//using-k6/thresholds) to set the test pass/fail criteria.
This script codifies two SLOs in the `thresholds` object, one about error rate (availability) and one about request duration (latency).
+
+
```javascript
export const options = {
thresholds: {
@@ -402,6 +404,8 @@ For example, consider a JSON file with a list of user info such as:
You can parameterize the users with the [`SharedArray`](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) object as follows:
+
+
```javascript
import { check } from 'k6';
import http from 'k6/http';
@@ -422,14 +426,14 @@ export default function () {
});
const headers = { 'Content-Type': 'application/json' };
- const res = http.post('https://httpbin.test.k6.io/post', payload, {
+ const res = http.post('https://quickpizza.grafana.com/api/post', payload, {
headers,
});
check(res, {
'Post status is 200': (r) => res.status === 200,
'Post Content-Type header': (r) => res.headers['Content-Type'] === 'application/json',
- 'Post response name': (r) => res.status === 200 && res.json().json.name === user.username,
+ 'Post response name': (r) => res.status === 200 && res.json().name === user.username,
});
}
```
@@ -445,6 +449,8 @@ Though a test might be designed to induce failures, sometimes we focus on only t
The test script must handle API errors to avoid runtime exceptions and to ensure that it tests how the SUT behaves under saturation according to the test goals.
For example, we could extend our script to do some operation that depends on the result of the previous request:
+
+
```javascript
import { check } from 'k6';
import http from 'k6/http';
@@ -463,21 +469,21 @@ export default function () {
surname: user.surname,
});
const headers = { 'Content-Type': 'application/json' };
- const res = http.post('https://httpbin.test.k6.io/post', payload, {
+ const res = http.post('https://quickpizza.grafana.com/api/post', payload, {
headers,
});
check(res, {
'Post status is 200': (r) => res.status === 200,
'Post Content-Type header': (r) => res.headers['Content-Type'] === 'application/json',
- 'Post response name': (r) => res.status === 200 && res.json().json.name === user.username,
+ 'Post response name': (r) => res.status === 200 && res.json().name === user.username,
});
if (res.status === 200) {
// enters only successful responses
// otherwise, it triggers an exception
- const delPayload = JSON.stringify({ name: res.json().json.name });
- http.patch('https://httpbin.test.k6.io/patch', delPayload, { headers });
+ const delPayload = JSON.stringify({ name: res.json().name });
+ http.patch('https://quickpizza.grafana.com/api/patch', delPayload, { headers });
}
}
```
@@ -591,6 +597,8 @@ By default, k6 supports testing the following protocols:
- [Redis (experimental)](https://grafana.com/docs/k6//javascript-api/k6-experimental/redis/)
- [gRPC](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/)
+
+
```javascript
import grpc from 'k6/net/grpc';
import { check, sleep } from 'k6';
diff --git a/docs/sources/k6/v0.54.x/using-k6/cookies.md b/docs/sources/k6/v0.54.x/using-k6/cookies.md
index 183a7cbcd2..8008c67f37 100644
--- a/docs/sources/k6/v0.54.x/using-k6/cookies.md
+++ b/docs/sources/k6/v0.54.x/using-k6/cookies.md
@@ -42,7 +42,7 @@ in subsequent requests to the server, include the cookie in the `cookies` reques
import http from 'k6/http';
export default function () {
- http.get('https://httpbin.test.k6.io/cookies', {
+ http.get('https://quickpizza.grafana.com/api/cookies', {
cookies: {
my_cookie: 'hello world',
},
@@ -64,8 +64,8 @@ import http from 'k6/http';
export default function () {
const jar = http.cookieJar();
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie', 'hello world');
- http.get('https://httpbin.test.k6.io/cookies');
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'my_cookie', 'hello world');
+ http.get('https://quickpizza.grafana.com/api/cookies');
}
```
@@ -84,7 +84,7 @@ import { check } from 'k6';
export default function () {
const jar = http.cookieJar();
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie', 'hello world');
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'my_cookie', 'hello world');
const cookies = {
my_cookie: {
@@ -93,7 +93,7 @@ export default function () {
},
};
- const res = http.get('https://httpbin.test.k6.io/cookies', {
+ const res = http.get('https://quickpizza.grafana.com/api/cookies', {
cookies,
});
@@ -116,7 +116,7 @@ import http from 'k6/http';
import { check } from 'k6';
export default function () {
- const res = http.get('https://httpbin.test.k6.io/cookies/set?my_cookie=hello%20world', {
+ const res = http.post('https://quickpizza.grafana.com/api/cookies?my_cookie=hello%20world', {
redirects: 0,
});
check(res, {
@@ -159,11 +159,11 @@ import http from 'k6/http';
import { check } from 'k6';
export default function () {
- const res = http.get('https://httpbin.test.k6.io/cookies/set?my_cookie=hello%20world', {
+ const res = http.post('https://quickpizza.grafana.com/api/cookies?my_cookie=hello%20world', {
redirects: 0,
});
const jar = http.cookieJar();
- const cookies = jar.cookiesForURL('https://httpbin.test.k6.io/');
+ const cookies = jar.cookiesForURL('https://quickpizza.grafana.com/api/cookies');
check(res, {
"has cookie 'my_cookie'": (r) => cookies.my_cookie.length > 0,
'cookie has correct value': (r) => cookies.my_cookie[0] === 'hello world',
@@ -191,17 +191,17 @@ import { check } from 'k6';
export default function () {
const jar = http.cookieJar();
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie', 'hello world', {
- domain: 'httpbin.test.k6.io',
- path: '/cookies',
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'my_cookie', 'hello world', {
+ domain: 'quickpizza.grafana.com',
+ path: '/api/cookies',
secure: true,
max_age: 600,
});
- const res = http.get('https://httpbin.test.k6.io/cookies');
+ const res = http.get('https://quickpizza.grafana.com/api/cookies');
+
check(res, {
'has status 200': (r) => r.status === 200,
- "has cookie 'my_cookie'": (r) => r.cookies.my_cookie[0] !== null,
- 'cookie has correct value': (r) => r.cookies.my_cookie[0].value == 'hello world',
+ 'cookie has correct value': (r) => r.json().cookies.my_cookie == 'hello world',
});
}
```
@@ -224,19 +224,18 @@ export default function () {
// Add cookie to local jar
const cookieOptions = {
- domain: 'httpbin.test.k6.io',
- path: '/cookies',
+ domain: 'quickpizza.grafana.com',
+ path: '/api/cookies',
secure: true,
max_age: 600,
};
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie', 'hello world', cookieOptions);
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'my_cookie', 'hello world', cookieOptions);
// Override per-VU jar with local jar for the following request
- const res = http.get('https://httpbin.test.k6.io/cookies', { jar });
+ const res = http.get('https://quickpizza.grafana.com/api/cookies', { jar });
check(res, {
'has status 200': (r) => r.status === 200,
- "has cookie 'my_cookie'": (r) => r.cookies.my_cookie[0] !== null,
- 'cookie has correct value': (r) => r.cookies.my_cookie[0].value == 'hello world',
+ 'cookie has correct value': (r) => r.json().cookies.my_cookie == 'hello world',
});
}
```
diff --git a/docs/sources/k6/v0.54.x/using-k6/metrics/create-custom-metrics.md b/docs/sources/k6/v0.54.x/using-k6/metrics/create-custom-metrics.md
index 56d2cc0200..10e707f32a 100644
--- a/docs/sources/k6/v0.54.x/using-k6/metrics/create-custom-metrics.md
+++ b/docs/sources/k6/v0.54.x/using-k6/metrics/create-custom-metrics.md
@@ -29,6 +29,7 @@ This limits memory and ensures that k6 can validate that all thresholds are eval
The generic procedure to create a custom metric is as follows:
1. Import the [`k6/metrics`](https://grafana.com/docs/k6//javascript-api/k6-metrics) module. Optionally, specify the type of metrics you want to create with a named import:
+
```javascript
import { Trend } from 'k6/metrics';
@@ -37,6 +38,8 @@ The generic procedure to create a custom metric is as follows:
1. In init context, construct a new custom-metric object.
For example, the following creates a custom trend. The object in the script is called `myTrend`, and its metric appears in the results output as `waiting_time`.
+
+
```javascript
const myTrend = new Trend('waiting_time');
@@ -57,7 +60,7 @@ import { Trend } from 'k6/metrics';
const myTrend = new Trend('waiting_time');
export default function () {
- const r = http.get('https://httpbin.test.k6.io');
+ const r = http.get('https://quickpizza.grafana.com/');
myTrend.add(r.timings.waiting);
console.log(myTrend.name); // waiting_time
}
diff --git a/docs/sources/k6/v0.54.x/using-k6/scenarios/concepts/graceful-stop.md b/docs/sources/k6/v0.54.x/using-k6/scenarios/concepts/graceful-stop.md
index b828ac9390..e2002fda61 100644
--- a/docs/sources/k6/v0.54.x/using-k6/scenarios/concepts/graceful-stop.md
+++ b/docs/sources/k6/v0.54.x/using-k6/scenarios/concepts/graceful-stop.md
@@ -40,7 +40,7 @@ export const options = {
export default function () {
const delay = Math.floor(Math.random() * 5) + 1;
- http.get(`https://httpbin.test.k6.io/delay/${delay}`);
+ http.get(`https://quickpizza.grafana.com/api/delay/${delay}`);
}
```
diff --git a/docs/sources/k6/v0.54.x/using-k6/scenarios/concepts/open-vs-closed.md b/docs/sources/k6/v0.54.x/using-k6/scenarios/concepts/open-vs-closed.md
index 1fc96de47a..ab8e7e7799 100644
--- a/docs/sources/k6/v0.54.x/using-k6/scenarios/concepts/open-vs-closed.md
+++ b/docs/sources/k6/v0.54.x/using-k6/scenarios/concepts/open-vs-closed.md
@@ -46,7 +46,7 @@ export default function () {
// and we can expect to get 10 iterations completed in total for the
// full 1m test duration.
- http.get('https://httpbin.test.k6.io/delay/6');
+ http.get('https://quickpizza.grafana.com/api/delay/6');
}
```
@@ -113,7 +113,7 @@ export default function () {
// new VU iterations will start at a rate of 1 every second,
// and we can thus expect to get 60 iterations completed
// for the full 1m test duration.
- http.get('https://httpbin.test.k6.io/delay/6');
+ http.get('https://quickpizza.grafana.com/api/delay/6');
}
```
diff --git a/docs/sources/k6/v0.54.x/using-k6/tags-and-groups.md b/docs/sources/k6/v0.54.x/using-k6/tags-and-groups.md
index 77f3d96c57..cc56e00329 100644
--- a/docs/sources/k6/v0.54.x/using-k6/tags-and-groups.md
+++ b/docs/sources/k6/v0.54.x/using-k6/tags-and-groups.md
@@ -83,7 +83,7 @@ const myTrend = new Trend('my_trend');
export default function () {
// Add tag to request metric data
- const res = http.get('https://httpbin.test.k6.io/', {
+ const res = http.get('https://quickpizza.grafana.com/', {
tags: {
my_tag: "I'm a tag",
},
@@ -109,6 +109,7 @@ You can set these tags in two ways:
- In the script itself:
{{< code >}}
+
```javascript
export const options = {
@@ -128,6 +129,8 @@ To support advanced tagging workflows, it is also possible to directly set and g
[k6/execution.vu.tags](https://grafana.com/docs/k6//javascript-api/k6-execution/#vu) object's properties can indeed be directly assigned new key/value pairs to define new tags dynamically. This can prove useful, as demonstrated in the following example, to track a container's group from nested groups, and aggregating nested group's sub-metrics.
+
+
```javascript
import http from 'k6/http';
import exec from 'k6/execution';
@@ -146,14 +149,14 @@ export default function () {
group('main', function () {
http.get('https://test.k6.io');
group('sub', function () {
- http.get('https://httpbin.test.k6.io/anything');
+ http.get('https://quickpizza.grafana.com/');
});
http.get('https://test-api.k6.io');
});
delete exec.vu.tags.containerGroup;
- http.get('https://httpbin.test.k6.io/delay/3');
+ http.get('https://quickpizza.grafana.com/api/delay/3');
}
```
@@ -175,6 +178,8 @@ Similar to other tags tag, the tag is added to all samples collected during the
One way to tag the executed operations is to invoke the `tagWithCurrentStageIndex` function for setting a `stage` tag for identifying the stage that has executed them:
+
+
```javascript
import http from 'k6/http';
import exec from 'k6/execution';
@@ -182,8 +187,8 @@ import { tagWithCurrentStageIndex } from 'https://jslib.k6.io/k6-utils/1.3.0/ind
export const options = {
stages: [
- { target: 5, duration: '5s' },
- { target: 10, duration: '10s' },
+ { target: 5, duration: '2s' },
+ { target: 10, duration: '5s' },
],
};
@@ -198,13 +203,15 @@ export default function () {
Additionally, a profiling function `tagWithCurrentStageProfile` can add a tag with a computed profile of the current running stage:
+
+
```javascript
import http from 'k6/http';
import exec from 'k6/execution';
import { tagWithCurrentStageProfile } from 'https://jslib.k6.io/k6-utils/1.3.0/index.js';
export const options = {
- stages: [{ target: 10, duration: '10s' }],
+ stages: [{ target: 2, duration: '5s' }],
};
export default function () {
@@ -238,7 +245,7 @@ The profile value based on the current stage can be one of the following options
"group ": "::my group::json ",
"method ": "GET ",
"status ": "200 ",
- "url ": "https://httpbin.test.k6.io/get "
+ "url ": "http://quickpizza.grafana.com"
}
},
"metric ": "http_req_duration "
@@ -319,16 +326,18 @@ import http from 'k6/http';
const id = 5;
-// reconsider this type of code
-group('get post', function () {
- http.get(`http://example.com/posts/${id}`);
-});
-group('list posts', function () {
- const res = http.get(`http://example.com/posts`);
- check(res, {
- 'is status 200': (r) => r.status === 200,
+export default function () {
+ // reconsider this type of code
+ group('get post', function () {
+ http.get(`http://example.com/posts/${id}`);
});
-});
+ group('list posts', function () {
+ const res = http.get(`http://example.com/posts`);
+ check(res, {
+ 'is status 200': (r) => r.status === 200,
+ });
+ });
+}
```
{{< /code >}}
diff --git a/docs/sources/k6/v0.54.x/using-k6/test-lifecycle.md b/docs/sources/k6/v0.54.x/using-k6/test-lifecycle.md
index 46f612691c..02f91ce4f3 100644
--- a/docs/sources/k6/v0.54.x/using-k6/test-lifecycle.md
+++ b/docs/sources/k6/v0.54.x/using-k6/test-lifecycle.md
@@ -76,6 +76,8 @@ Code in the `init` context _always executes first_.
{{< code >}}
+
+
```javascript
// init context: importing modules
import http from 'k6/http';
@@ -152,7 +154,7 @@ For example, you can make HTTP requests:
import http from 'k6/http';
export function setup() {
- const res = http.get('https://httpbin.test.k6.io/get');
+ const res = http.get('https://quickpizza.grafana.com/api/json');
return { data: res.json() };
}
@@ -258,6 +260,7 @@ k6 has a few additional ways to use lifecycle functions:
- **Scenario functions**. Instead of the `default` function, you can also run VU code in scenario functions.
{{< code >}}
+
```javascript
import http from 'k6/http';
diff --git a/docs/sources/k6/v0.54.x/using-k6/thresholds.md b/docs/sources/k6/v0.54.x/using-k6/thresholds.md
index 9093546701..634f702bda 100644
--- a/docs/sources/k6/v0.54.x/using-k6/thresholds.md
+++ b/docs/sources/k6/v0.54.x/using-k6/thresholds.md
@@ -35,6 +35,8 @@ The other evaluates whether 95 percent of responses happen within a certain dura
{{< code >}}
+
+
```javascript
import http from 'k6/http';
@@ -79,6 +81,7 @@ and k6 would exit with a non-zero exit code.
To use a threshold, follow these steps:
1. In the `thresholds` property of the `options` object, set a key using the name of the metric you want the threshold for:
+
```javascript
export const options = {
@@ -92,6 +95,7 @@ To use a threshold, follow these steps:
- The short format puts all threshold expressions as strings in an array.
- The long format puts each threshold in an object, with extra properties to [abort on failure](#abort-a-test-when-a-threshold-is-crossed).
+
```javascript
export const options = {
@@ -148,26 +152,28 @@ setting different types of thresholds for each:
{{< code >}}
+
+
```javascript
import http from 'k6/http';
import { Trend, Rate, Counter, Gauge } from 'k6/metrics';
import { sleep } from 'k6';
export const TrendRTT = new Trend('RTT');
-export const RateContentOK = new Rate('Content OK');
+export const RateContentOK = new Rate('ContentOK');
export const GaugeContentSize = new Gauge('ContentSize');
export const CounterErrors = new Counter('Errors');
export const options = {
thresholds: {
// Count: Incorrect content cannot be returned more than 99 times.
- 'Errors': ['count<100'],
+ Errors: ['count<100'],
// Gauge: returned content must be smaller than 4000 bytes
- 'ContentSize': ['value<4000'],
+ ContentSize: ['value<4000'],
// Rate: content must be OK more than 95 times
- 'Content OK': ['rate>0.95'],
+ ContentOK: ['rate>0.95'],
// Trend: Percentiles, averages, medians, and minimums
// must be within specified milliseconds.
- 'RTT': ['p(99)<300', 'p(70)<250', 'avg<200', 'med<150', 'min<100'],
+ RTT: ['p(99)<300', 'p(70)<250', 'avg<200', 'med<150', 'min<100'],
},
};
@@ -196,6 +202,8 @@ Since thresholds are defined as the properties of a JavaScript object, you can't
{{< code >}}
+
+
```javascript
export const options = {
thresholds: {
@@ -298,6 +306,8 @@ For each group, there are different thresholds.
{{< code >}}
+
+
```javascript
import http from 'k6/http';
import { group, sleep } from 'k6';
@@ -337,6 +347,8 @@ export default function () {
It's often useful to specify thresholds on a single URL or specific tag.
In k6, tagged requests create sub-metrics that you can use in thresholds:
+
+
```javascript
export const options = {
thresholds: {
@@ -349,6 +361,8 @@ And here's a full example.
{{< code >}}
+
+
```javascript
import http from 'k6/http';
import { sleep } from 'k6';
@@ -398,6 +412,8 @@ After ten seconds, the test aborts if it fails the `p(99) < 10` threshold.
{{< code >}}
+
+
```javascript
export const options = {
thresholds: {
@@ -427,6 +443,8 @@ Here is an example:
{{< code >}}
+
+
```javascript
import http from 'k6/http';
@@ -476,7 +494,7 @@ export const options = {
};
export default function () {
- const res = http.get('https://httpbin.test.k6.io');
+ const res = http.get('https://quickpizza.grafana.com/api/status/500');
check(res, {
'status is 500': (r) => r.status == 500,
@@ -509,12 +527,12 @@ export const options = {
export default function () {
let res;
- res = http.get('https://httpbin.test.k6.io');
+ res = http.get('https://quickpizza.grafana.com/api/status/500');
check(res, {
'status is 500': (r) => r.status == 500,
});
- res = http.get('https://httpbin.test.k6.io');
+ res = http.get('https://quickpizza.grafana.com/api/status/200');
check(
res,
{
diff --git a/docs/sources/k6/v0.54.x/using-k6/workaround-iteration-duration.md b/docs/sources/k6/v0.54.x/using-k6/workaround-iteration-duration.md
index afcdec629f..408c161d1c 100644
--- a/docs/sources/k6/v0.54.x/using-k6/workaround-iteration-duration.md
+++ b/docs/sources/k6/v0.54.x/using-k6/workaround-iteration-duration.md
@@ -35,7 +35,7 @@ export const options = {
};
export function setup() {
- http.get('https://httpbin.test.k6.io/delay/5');
+ http.get('https://quickpizza.grafana.com/api/delay/5');
}
export default function () {
@@ -44,7 +44,7 @@ export default function () {
}
export function teardown() {
- http.get('https://httpbin.test.k6.io/delay/3');
+ http.get('https://quickpizza.grafana.com/api/delay/3');
sleep(5);
}
```
diff --git a/docs/sources/k6/v0.55.x/examples/cookies-example.md b/docs/sources/k6/v0.55.x/examples/cookies-example.md
index 81d65d9c14..213477412b 100644
--- a/docs/sources/k6/v0.55.x/examples/cookies-example.md
+++ b/docs/sources/k6/v0.55.x/examples/cookies-example.md
@@ -25,7 +25,7 @@ import { check, group } from 'k6';
export default function () {
// Since this request redirects the `res.cookies` property won't contain the cookies
- const res = http.get('https://httpbin.test.k6.io/cookies/set?name1=value1&name2=value2');
+ const res = http.post('https://quickpizza.grafana.com/api/cookies?name1=value1&name2=value2');
check(res, {
'status is 200': (r) => r.status === 200,
});
@@ -97,9 +97,9 @@ export default function () {
// that a request must match (domain, path, HTTPS or not etc.)
// to have the cookie attached to it when sent to the server.
const jar = http.cookieJar();
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie', 'hello world', {
- domain: 'httpbin.test.k6.io',
- path: '/cookies',
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'my_cookie', 'hello world', {
+ domain: 'quickpizza.grafana.com',
+ path: '/api/cookies',
secure: true,
max_age: 600,
});
@@ -107,7 +107,7 @@ export default function () {
// As the following request is matching the above cookie in terms of domain,
// path, HTTPS (secure) and will happen within the specified "age" limit, the
// cookie will be attached to this request.
- const res = http.get('https://httpbin.test.k6.io/cookies');
+ const res = http.get('https://quickpizza.grafana.com/api/cookies');
check(res, {
'has status 200': (r) => r.status === 200,
"has cookie 'my_cookie'": (r) => r.json().cookies.my_cookie !== null,
@@ -130,10 +130,10 @@ import { check } from 'k6';
export default function () {
const jar = http.cookieJar();
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie_1', 'hello world_1');
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie_2', 'hello world_2');
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'my_cookie_1', 'hello world_1');
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'my_cookie_2', 'hello world_2');
- const res1 = http.get('https://httpbin.test.k6.io/cookies');
+ const res1 = http.get('https://quickpizza.grafana.com/api/cookies');
check(res1, {
'res1 has status 200': (r) => r.status === 200,
"res1 has cookie 'my_cookie_1'": (r) => r.json().cookies.my_cookie_1 !== null,
@@ -142,9 +142,9 @@ export default function () {
'res1 cookie has correct value_2': (r) => r.json().cookies.my_cookie_2 == 'hello world_2',
});
- jar.delete('https://httpbin.test.k6.io/cookies', 'my_cookie_1');
+ jar.delete('https://quickpizza.grafana.com/api/cookies', 'my_cookie_1');
- const res2 = http.get('https://httpbin.test.k6.io/cookies');
+ const res2 = http.get('https://quickpizza.grafana.com/api/cookies');
check(res2, {
'res2 has status 200': (r) => r.status === 200,
"res2 hasn't cookie 'my_cookie_1'": (r) => r.json().cookies.my_cookie_1 == null,
@@ -168,17 +168,17 @@ import { check } from 'k6';
export default function () {
const jar = http.cookieJar();
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie', 'hello world');
- const res1 = http.get('https://httpbin.test.k6.io/cookies');
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'my_cookie', 'hello world');
+ const res1 = http.get('https://quickpizza.grafana.com/api/cookies');
check(res1, {
'has status 200': (r) => r.status === 200,
"has cookie 'my_cookie'": (r) => r.json().cookies.my_cookie !== null,
'cookie has correct value': (r) => r.json().cookies.my_cookie == 'hello world',
});
- jar.clear('https://httpbin.test.k6.io/cookies');
+ jar.clear('https://quickpizza.grafana.com/api/cookies');
- const res2 = http.get('https://httpbin.test.k6.io/cookies');
+ const res2 = http.get('https://quickpizza.grafana.com/api/cookies');
check(res2, {
'has status 200': (r) => r.status === 200,
"hasn't cookie 'my_cookie'": (r) => r.json().cookies.my_cookie == null,
diff --git a/docs/sources/k6/v0.55.x/examples/correlation-and-dynamic-data.md b/docs/sources/k6/v0.55.x/examples/correlation-and-dynamic-data.md
index d5cbe1dd9f..8f51909b58 100644
--- a/docs/sources/k6/v0.55.x/examples/correlation-and-dynamic-data.md
+++ b/docs/sources/k6/v0.55.x/examples/correlation-and-dynamic-data.md
@@ -40,18 +40,23 @@ import { check } from 'k6';
export default function () {
// Make a request that returns some JSON data
- const res = http.get('https://httpbin.test.k6.io/json');
+ const reqHeaders = {
+ Authorization: 'Token abcdef0123456789',
+ };
+ const res = http.get('https://quickpizza.grafana.com/api/doughs', {
+ headers: reqHeaders,
+ });
// Extract data from that JSON data by first parsing it
// using a call to "json()" and then accessing properties by
// navigating the JSON data as a JS object with dot notation.
- const slide1 = res.json().slideshow.slides[0];
- check(slide1, {
- 'slide 1 has correct title': (s) => s.title === 'Wake up to WonderWidgets!',
- 'slide 1 has correct type': (s) => s.type === 'all',
+ const dough1 = res.json().doughs[0];
+ check(dough1, {
+ 'dough1 1 has correct name': (s) => s.name === 'Thin',
+ 'dough1 1 has correct ID': (s) => s.ID === 1,
});
- // Now we could use the "slide1" variable in subsequent requests...
+ // Now we could use the "dough1" variable in subsequent requests...
}
```
@@ -130,13 +135,13 @@ import http from 'k6/http';
export default function () {
// This request returns XML:
- const res = http.get('https://httpbin.test.k6.io/xml');
+ const res = http.get('https://quickpizza.grafana.com/api/xml?color=green');
- // Use findBetween to extract the first title encountered:
- const title = findBetween(res.body, '', '');
+ // Use findBetween to extract the first tag encountered:
+ const color = findBetween(res.body, '', '');
- check(title, {
- 'title is correct': (t) => t === 'Wake up to WonderWidgets!',
+ check(color, {
+ 'color is correct': (t) => t === 'green',
});
}
```
diff --git a/docs/sources/k6/v0.55.x/examples/data-uploads.md b/docs/sources/k6/v0.55.x/examples/data-uploads.md
index 211cb8cc2c..f02d0b5a7b 100644
--- a/docs/sources/k6/v0.55.x/examples/data-uploads.md
+++ b/docs/sources/k6/v0.55.x/examples/data-uploads.md
@@ -128,7 +128,7 @@ export default function () {
fd.append('images', http.file(img2, 'image2.jpg', 'image/jpeg'));
fd.append('text', http.file(txt, 'text.txt', 'text/plain'));
- const res = http.post('https://httpbin.test.k6.io/post', fd.body(), {
+ const res = http.post('https://quickpizza.grafana.com/api/post', fd.body(), {
headers: { 'Content-Type': 'multipart/form-data; boundary=' + fd.boundary },
});
check(res, {
@@ -148,3 +148,5 @@ Note that:
- Blob is not supported or implemented. For the same functionality, use
a simple object with the fields `data`, `content_type` (defaulting to "application/octet-stream") and optionally
`filename` as shown for `aBinaryFile` above.
+
+
diff --git a/docs/sources/k6/v0.55.x/examples/get-timings-for-an-http-metric.md b/docs/sources/k6/v0.55.x/examples/get-timings-for-an-http-metric.md
index 03a4645836..bc30c60bca 100644
--- a/docs/sources/k6/v0.55.x/examples/get-timings-for-an-http-metric.md
+++ b/docs/sources/k6/v0.55.x/examples/get-timings-for-an-http-metric.md
@@ -27,7 +27,7 @@ This script gets the request duration timing for a specific GET request and logs
import http from 'k6/http';
export default function () {
- const res = http.get('https://httpbin.test.k6.io');
+ const res = http.get('https://quickpizza.grafana.com/');
console.log('Response time was ' + String(res.timings.duration) + ' ms');
}
```
diff --git a/docs/sources/k6/v0.55.x/examples/html-forms.md b/docs/sources/k6/v0.55.x/examples/html-forms.md
index e640c3b040..68328be1b1 100644
--- a/docs/sources/k6/v0.55.x/examples/html-forms.md
+++ b/docs/sources/k6/v0.55.x/examples/html-forms.md
@@ -18,12 +18,12 @@ import { sleep } from 'k6';
export default function () {
// Request page containing a form
- let res = http.get('https://httpbin.test.k6.io/forms/post');
+ let res = http.get('https://quickpizza.grafana.com/admin');
// Now, submit form setting/overriding some fields of the form
res = res.submitForm({
formSelector: 'form',
- fields: { custname: 'test', extradata: 'test2' },
+ fields: { username: 'admin', password: 'admin' },
});
sleep(3);
}
diff --git a/docs/sources/k6/v0.55.x/examples/http-authentication.md b/docs/sources/k6/v0.55.x/examples/http-authentication.md
index 97fb2fc24d..da8385fb9f 100644
--- a/docs/sources/k6/v0.55.x/examples/http-authentication.md
+++ b/docs/sources/k6/v0.55.x/examples/http-authentication.md
@@ -25,7 +25,7 @@ export default function () {
// Passing username and password as part of the URL will
// allow us to authenticate using HTTP Basic Auth.
- const url = `https://${credentials}@httpbin.test.k6.io/basic-auth/${username}/${password}`;
+ const url = `https://${credentials}@quickpizza.grafana.com/api/basic-auth/${username}/${password}`;
let res = http.get(url);
@@ -45,9 +45,9 @@ export default function () {
},
};
- res = http.get(`https://httpbin.test.k6.io/basic-auth/${username}/${password}`, options);
+ res = http.get(`https://quickpizza.grafana.com/api/basic-auth/${username}/${password}`, options);
- // Verify response (checking the echoed data from the httpbin.test.k6.io
+ // Verify response (checking the echoed data from the QuickPizza
// basic auth test API endpoint)
check(res, {
'status is 200': (r) => r.status === 200,
@@ -59,40 +59,6 @@ export default function () {
{{< /code >}}
-## Digest authentication
-
-{{< code >}}
-
-```javascript
-import http from 'k6/http';
-import { check } from 'k6';
-
-const username = 'user';
-const password = 'passwd';
-
-export default function () {
- // Passing username and password as part of URL plus the auth option will
- // authenticate using HTTP Digest authentication.
- const credentials = `${username}:${password}`;
- const res = http.get(
- `https://${credentials}@httpbin.test.k6.io/digest-auth/auth/${username}/${password}`,
- {
- auth: 'digest',
- }
- );
-
- // Verify response (checking the echoed data from the httpbin.test.k6.io digest auth
- // test API endpoint)
- check(res, {
- 'status is 200': (r) => r.status === 200,
- 'is authenticated': (r) => r.json().authenticated === true,
- 'is correct user': (r) => r.json().user === username,
- });
-}
-```
-
-{{< /code >}}
-
## NTLM authentication
{{< code >}}
@@ -121,6 +87,8 @@ Here's an example script to demonstrate how to sign a request to fetch an object
{{< code >}}
+
+
```javascript
import http from 'k6/http';
import {
diff --git a/docs/sources/k6/v0.55.x/get-started/resources.md b/docs/sources/k6/v0.55.x/get-started/resources.md
index ca10a8a61e..ca383da5cc 100644
--- a/docs/sources/k6/v0.55.x/get-started/resources.md
+++ b/docs/sources/k6/v0.55.x/get-started/resources.md
@@ -32,7 +32,6 @@ If you need a place to learn k6 and test your scripts, you can use these playgro
- [test-api.k6.io](https://test-api.k6.io/). A simple REST and WebSocket web application. [grafana/test-api.k6.io](https://github.com/grafana/test-api.k6.io)
- [grafana/quickpizza](https://github.com/grafana/quickpizza). A simple demo web application.
-- [grafana/httpbin](https://github.com/grafana/httpbin). A simple HTTP Request & Response Service.
Note that these are shared testing environments - please avoid high-load tests. Alternatively, you can deploy and host them on your infrastructure and run the examples in the repository.
diff --git a/docs/sources/k6/v0.55.x/get-started/running-k6.md b/docs/sources/k6/v0.55.x/get-started/running-k6.md
index 59dd258153..2b7c357283 100644
--- a/docs/sources/k6/v0.55.x/get-started/running-k6.md
+++ b/docs/sources/k6/v0.55.x/get-started/running-k6.md
@@ -180,7 +180,7 @@ export const options = {
};
export default function () {
- const res = http.get('https://httpbin.test.k6.io/');
+ const res = http.get('https://quickpizza.grafana.com/');
check(res, { 'status was 200': (r) => r.status == 200 });
sleep(1);
}
diff --git a/docs/sources/k6/v0.55.x/javascript-api/jslib/httpx/asyncrequest.md b/docs/sources/k6/v0.55.x/javascript-api/jslib/httpx/asyncrequest.md
index 1dfd7aa0de..5f1fc7a0af 100644
--- a/docs/sources/k6/v0.55.x/javascript-api/jslib/httpx/asyncrequest.md
+++ b/docs/sources/k6/v0.55.x/javascript-api/jslib/httpx/asyncrequest.md
@@ -32,7 +32,7 @@ Note, this method returns a Promise. You must use the `await` keyword to resolve
import { Httpx } from 'https://jslib.k6.io/httpx/0.1.0/index.js';
const session = new Httpx({
- baseURL: 'https://httpbin.test.k6.io',
+ baseURL: 'https://quickpizza.grafana.com/api',
timeout: 20000, // 20s timeout.
});
diff --git a/docs/sources/k6/v0.55.x/javascript-api/jslib/httpx/delete.md b/docs/sources/k6/v0.55.x/javascript-api/jslib/httpx/delete.md
index 7b1a1499d9..5a21e413dc 100644
--- a/docs/sources/k6/v0.55.x/javascript-api/jslib/httpx/delete.md
+++ b/docs/sources/k6/v0.55.x/javascript-api/jslib/httpx/delete.md
@@ -29,7 +29,7 @@ weight: 14
import { Httpx } from 'https://jslib.k6.io/httpx/0.1.0/index.js';
const session = new Httpx({
- baseURL: 'https://httpbin.test.k6.io',
+ baseURL: 'https://quickpizza.grafana.com/api',
timeout: 20000, // 20s timeout.
});
diff --git a/docs/sources/k6/v0.55.x/javascript-api/jslib/httpx/head.md b/docs/sources/k6/v0.55.x/javascript-api/jslib/httpx/head.md
index 7cf0661111..74186e5c7e 100644
--- a/docs/sources/k6/v0.55.x/javascript-api/jslib/httpx/head.md
+++ b/docs/sources/k6/v0.55.x/javascript-api/jslib/httpx/head.md
@@ -29,12 +29,12 @@ weight: 16
import { Httpx } from 'https://jslib.k6.io/httpx/0.1.0/index.js';
const session = new Httpx({
- baseURL: 'https://httpbin.test.k6.io',
+ baseURL: 'https://quickpizza.grafana.com',
timeout: 20000, // 20s timeout.
});
export default function testSuite() {
- const resp = session.head(`/head`);
+ const resp = session.head(`/`);
console.log(resp.status);
}
```
diff --git a/docs/sources/k6/v0.55.x/javascript-api/jslib/httpx/options.md b/docs/sources/k6/v0.55.x/javascript-api/jslib/httpx/options.md
index d7310722aa..ed37f4f73a 100644
--- a/docs/sources/k6/v0.55.x/javascript-api/jslib/httpx/options.md
+++ b/docs/sources/k6/v0.55.x/javascript-api/jslib/httpx/options.md
@@ -29,12 +29,12 @@ weight: 15
import { Httpx } from 'https://jslib.k6.io/httpx/0.1.0/index.js';
const session = new Httpx({
- baseURL: 'https://httpbin.test.k6.io',
+ baseURL: 'https://quickpizza.grafana.com',
timeout: 20000, // 20s timeout.
});
export default function testSuite() {
- const resp = session.options(`/options`);
+ const resp = session.options(`/`);
console.log(resp.status);
}
```
diff --git a/docs/sources/k6/v0.55.x/javascript-api/jslib/httpx/patch.md b/docs/sources/k6/v0.55.x/javascript-api/jslib/httpx/patch.md
index c21488464f..29acadd260 100644
--- a/docs/sources/k6/v0.55.x/javascript-api/jslib/httpx/patch.md
+++ b/docs/sources/k6/v0.55.x/javascript-api/jslib/httpx/patch.md
@@ -30,7 +30,7 @@ weight: 13
import { Httpx } from 'https://jslib.k6.io/httpx/0.1.0/index.js';
const session = new Httpx({
- baseURL: 'https://httpbin.test.k6.io',
+ baseURL: 'https://quickpizza.grafana.com/api',
timeout: 20000, // 20s timeout.
});
diff --git a/docs/sources/k6/v0.55.x/javascript-api/jslib/httpx/put.md b/docs/sources/k6/v0.55.x/javascript-api/jslib/httpx/put.md
index b865d55225..2c519079ee 100644
--- a/docs/sources/k6/v0.55.x/javascript-api/jslib/httpx/put.md
+++ b/docs/sources/k6/v0.55.x/javascript-api/jslib/httpx/put.md
@@ -30,7 +30,7 @@ weight: 12
import { Httpx } from 'https://jslib.k6.io/httpx/0.1.0/index.js';
const session = new Httpx({
- baseURL: 'https://httpbin.test.k6.io',
+ baseURL: 'https://quickpizza.grafana.com/api',
timeout: 20000, // 20s timeout.
});
diff --git a/docs/sources/k6/v0.55.x/javascript-api/jslib/httpx/request.md b/docs/sources/k6/v0.55.x/javascript-api/jslib/httpx/request.md
index 774fc143b3..ec051467a1 100644
--- a/docs/sources/k6/v0.55.x/javascript-api/jslib/httpx/request.md
+++ b/docs/sources/k6/v0.55.x/javascript-api/jslib/httpx/request.md
@@ -33,7 +33,7 @@ Consider using specific methods for making common requests [get](https://grafana
import { Httpx } from 'https://jslib.k6.io/httpx/0.1.0/index.js';
const session = new Httpx({
- baseURL: 'https://httpbin.test.k6.io',
+ baseURL: 'https://quickpizza.grafana.com/api',
timeout: 20000, // 20s timeout.
});
diff --git a/docs/sources/k6/v0.55.x/javascript-api/jslib/httpx/trace.md b/docs/sources/k6/v0.55.x/javascript-api/jslib/httpx/trace.md
index 6057a953f6..5b396c4890 100644
--- a/docs/sources/k6/v0.55.x/javascript-api/jslib/httpx/trace.md
+++ b/docs/sources/k6/v0.55.x/javascript-api/jslib/httpx/trace.md
@@ -29,12 +29,12 @@ weight: 17
import { Httpx } from 'https://jslib.k6.io/httpx/0.1.0/index.js';
const session = new Httpx({
- baseURL: 'https://httpbin.test.k6.io',
+ baseURL: 'https://quickpizza.grafana.com',
timeout: 20000, // 20s timeout.
});
export default function testSuite() {
- const resp = session.trace(`/trace`);
+ const resp = session.trace(`/`);
console.log(resp.status);
}
```
diff --git a/docs/sources/k6/v0.55.x/javascript-api/jslib/utils/check.md b/docs/sources/k6/v0.55.x/javascript-api/jslib/utils/check.md
index 3ddb2fbc85..e3f09eb02f 100644
--- a/docs/sources/k6/v0.55.x/javascript-api/jslib/utils/check.md
+++ b/docs/sources/k6/v0.55.x/javascript-api/jslib/utils/check.md
@@ -39,7 +39,7 @@ function waitFor(delay) {
}
export default async function () {
- const res = http.get('https://httpbin.test.k6.io');
+ const res = http.get('https://quickpizza.grafana.com/');
const success = await check(res, {
'passing promise as a value': waitFor(1000),
diff --git a/docs/sources/k6/v0.55.x/javascript-api/k6-browser/browsercontext/setdefaultnavigationtimeout.md b/docs/sources/k6/v0.55.x/javascript-api/k6-browser/browsercontext/setdefaultnavigationtimeout.md
index ed1d41d63d..dd763ce1da 100644
--- a/docs/sources/k6/v0.55.x/javascript-api/k6-browser/browsercontext/setdefaultnavigationtimeout.md
+++ b/docs/sources/k6/v0.55.x/javascript-api/k6-browser/browsercontext/setdefaultnavigationtimeout.md
@@ -15,6 +15,8 @@ Sets the default maximum navigation timeout for [Page.goto()](https://grafana.co
{{< code >}}
+
+
```javascript
import { browser } from 'k6/browser';
@@ -37,7 +39,7 @@ export default async function () {
context.setDefaultNavigationTimeout(1000); // 1s
try {
- await page.goto('https://httpbin.test.k6.io/delay/5');
+ await page.goto('https://quickpizza.grafana.com/api/delay/5');
} finally {
await page.close();
}
diff --git a/docs/sources/k6/v0.55.x/javascript-api/k6-browser/response/json.md b/docs/sources/k6/v0.55.x/javascript-api/k6-browser/response/json.md
index 1c1aaa66c1..ecd7adea9d 100644
--- a/docs/sources/k6/v0.55.x/javascript-api/k6-browser/response/json.md
+++ b/docs/sources/k6/v0.55.x/javascript-api/k6-browser/response/json.md
@@ -37,10 +37,10 @@ export default async function () {
const page = await browser.newPage();
try {
- const res = await page.goto('https://httpbin.test.k6.io/json');
+ const res = await page.goto('https://quickpizza.grafana.com/api/json?foo=bar');
const json = await res.json();
- console.log(`json: ${JSON.stringify(json)}`); // json: {"slideshow":
+ console.log(`json: ${JSON.stringify(json)}`); // json: {"foo": "bar"}
} finally {
await page.close();
}
diff --git a/docs/sources/k6/v0.55.x/javascript-api/k6-data/sharedarray.md b/docs/sources/k6/v0.55.x/javascript-api/k6-data/sharedarray.md
index 5750ac52f5..4d1e00d48d 100644
--- a/docs/sources/k6/v0.55.x/javascript-api/k6-data/sharedarray.md
+++ b/docs/sources/k6/v0.55.x/javascript-api/k6-data/sharedarray.md
@@ -13,6 +13,8 @@ When a script requests an element, k6 gives a _copy_ of that element.
You must construct a `SharedArray` in the [`init` context](https://grafana.com/docs/k6//using-k6/test-lifecycle).
Its constructor takes a name for the `SharedArray` and a function that needs to return an array object itself:
+
+
```javascript
import { SharedArray } from 'k6/data';
@@ -49,6 +51,8 @@ This limitation will eventually be removed, but for now, the implication is that
{{< code >}}
+
+
```javascript
import { SharedArray } from 'k6/data';
@@ -79,6 +83,8 @@ To test this, we ran the following script on version v0.31.0 with 100 VUs.
{{< code >}}
+
+
```javascript
import { check } from 'k6';
import http from 'k6/http';
@@ -102,7 +108,7 @@ if (__ENV.SHARED === 'true') {
export default function () {
const iterationData = data[Math.floor(Math.random() * data.length)];
- const res = http.post('https://httpbin.test.k6.io/anything', JSON.stringify(iterationData), {
+ const res = http.post('https://quickpizza.grafana.com/api/post', JSON.stringify(iterationData), {
headers: { 'Content-type': 'application/json' },
});
check(res, { 'status 200': (r) => r.status === 200 });
diff --git a/docs/sources/k6/v0.55.x/javascript-api/k6-http/asyncrequest.md b/docs/sources/k6/v0.55.x/javascript-api/k6-http/asyncrequest.md
index 8b8ddf6d20..6734c97171 100644
--- a/docs/sources/k6/v0.55.x/javascript-api/k6-http/asyncrequest.md
+++ b/docs/sources/k6/v0.55.x/javascript-api/k6-http/asyncrequest.md
@@ -29,21 +29,20 @@ Using http.asyncRequest() to issue a POST request:
```javascript
import http from 'k6/http';
-const url = 'https://httpbin.test.k6.io/post';
+const url = 'https://quickpizza.grafana.com/api/post';
export default async function () {
const data = { name: 'Bert' };
// Using a JSON string as body
- let res = await http.asyncRequest('POST', url, JSON.stringify(data), {
+ const res = await http.asyncRequest('POST', url, JSON.stringify(data), {
headers: { 'Content-Type': 'application/json' },
});
- console.log(res.json().json.name); // Bert
+ console.log(res.json().name); // Bert
// Using an object as body, the headers will automatically include
// 'Content-Type: application/x-www-form-urlencoded'.
- res = await http.asyncRequest('POST', url, data);
- console.log(res.json().form.name); // Bert
+ await http.asyncRequest('POST', url, data);
}
```
@@ -57,9 +56,9 @@ Using `http.asyncRequest()` to issue multiple requests, then [Promise.race](http
import http from 'k6/http';
export default async () => {
- const urlOne = `https://httpbin.test.k6.io/delay/${randomInt(1, 5)}`;
- const urlTwo = `https://httpbin.test.k6.io/delay/${randomInt(1, 5)}`;
- const urlThree = `https://httpbin.test.k6.io/delay/${randomInt(1, 5)}`;
+ const urlOne = `https://quickpizza.grafana.com/api/delay/${randomInt(1, 5)}`;
+ const urlTwo = `https://quickpizza.grafana.com/api/delay/${randomInt(1, 5)}`;
+ const urlThree = `https://quickpizza.grafana.com/api/delay/${randomInt(1, 5)}`;
const one = http.asyncRequest('GET', urlOne);
const two = http.asyncRequest('GET', urlTwo);
diff --git a/docs/sources/k6/v0.55.x/javascript-api/k6-http/batch.md b/docs/sources/k6/v0.55.x/javascript-api/k6-http/batch.md
index a0d9ec5f29..752d898566 100644
--- a/docs/sources/k6/v0.55.x/javascript-api/k6-http/batch.md
+++ b/docs/sources/k6/v0.55.x/javascript-api/k6-http/batch.md
@@ -91,27 +91,25 @@ import { check } from 'k6';
export default function () {
const req1 = {
method: 'GET',
- url: 'https://httpbin.test.k6.io/get',
+ url: 'https://quickpizza.grafana.com/api/get',
};
const req2 = {
- method: 'GET',
- url: 'https://test.k6.io',
+ method: 'DELETE',
+ url: 'https://quickpizza.grafana.com/api/delete',
};
const req3 = {
method: 'POST',
- url: 'https://httpbin.test.k6.io/post',
- body: {
- hello: 'world!',
- },
+ url: 'https://quickpizza.grafana.com/api/post',
+ body: JSON.stringify({ hello: 'world!' }),
params: {
- headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
+ headers: { 'Content-Type': 'application/json' },
},
};
const responses = http.batch([req1, req2, req3]);
- // httpbin.test.k6.io should return our POST data in the response body, so
+ // QuickPizza should return our POST data in the response body, so
// we check the third response object to see that the POST worked.
check(responses[2], {
- 'form data OK': (res) => JSON.parse(res.body)['form']['hello'] == 'world!',
+ 'form data OK': (res) => JSON.parse(res.body)['hello'] == 'world!',
});
}
```
diff --git a/docs/sources/k6/v0.55.x/javascript-api/k6-http/cookiejar/_index.md b/docs/sources/k6/v0.55.x/javascript-api/k6-http/cookiejar/_index.md
index cb001cf382..616e58b8a6 100644
--- a/docs/sources/k6/v0.55.x/javascript-api/k6-http/cookiejar/_index.md
+++ b/docs/sources/k6/v0.55.x/javascript-api/k6-http/cookiejar/_index.md
@@ -22,19 +22,19 @@ import http from 'k6/http';
import { check } from 'k6';
export default function () {
- const res1 = http.get('https://httpbin.test.k6.io/cookies/set?my_cookie=hello%20world', {
+ const res1 = http.post('https://quickpizza.grafana.com/api/cookies?my_cookie=hello%20world', {
redirects: 0,
});
const jar = http.cookieJar();
- const cookies = jar.cookiesForURL('https://httpbin.test.k6.io/');
+ const cookies = jar.cookiesForURL('https://quickpizza.grafana.com/api/cookies');
check(res1, {
"has cookie 'my_cookie'": (r) => cookies.my_cookie.length > 0,
'cookie has correct value': (r) => cookies.my_cookie[0] === 'hello world',
});
- jar.clear('https://httpbin.test.k6.io/cookies');
+ jar.clear('https://quickpizza.grafana.com/api/cookies');
- const res2 = http.get('https://httpbin.test.k6.io/cookies');
+ const res2 = http.get('https://quickpizza.grafana.com/api/cookies');
check(res2, {
'has status 200': (r) => r.status === 200,
"hasn't cookie 'my_cookie'": (r) => r.json().cookies.my_cookie == null,
diff --git a/docs/sources/k6/v0.55.x/javascript-api/k6-http/cookiejar/cookiejar-clear.md b/docs/sources/k6/v0.55.x/javascript-api/k6-http/cookiejar/cookiejar-clear.md
index b0dcc88b01..ca8f0315a2 100644
--- a/docs/sources/k6/v0.55.x/javascript-api/k6-http/cookiejar/cookiejar-clear.md
+++ b/docs/sources/k6/v0.55.x/javascript-api/k6-http/cookiejar/cookiejar-clear.md
@@ -17,29 +17,29 @@ description: 'Delete all cookies for the given URL.'
import http from 'k6/http';
export default function () {
- http.get('https://httpbin.test.k6.io/cookies/set?one=1&two=2');
+ http.post('https://quickpizza.grafana.com/api/cookies?one=1&two=2');
- // We'll use httpbin's reflection to see what cookies we
+ // We'll use QuickPizza's cookie reflection to see what cookies we
// are actually sending to the server after every change
- let httpbinResp;
- httpbinResp = http.get('https://httpbin.test.k6.io/cookies');
- console.log(JSON.stringify(httpbinResp.json().cookies));
+ let qpResp;
+ qpResp = http.get('https://quickpizza.grafana.com/api/cookies');
+ console.log(JSON.stringify(qpResp.json().cookies));
// Will print '{"one":"1","two":"2"}'
const jar = http.cookieJar(); // get the VU specific jar
- jar.set('https://httpbin.test.k6.io/cookies', 'three', '3');
- httpbinResp = http.get('https://httpbin.test.k6.io/cookies');
- console.log(JSON.stringify(httpbinResp.json().cookies));
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'three', '3');
+ qpResp = http.get('https://quickpizza.grafana.com/api/cookies');
+ console.log(JSON.stringify(qpResp.json().cookies));
// Will print '{"one":"1","three":"3","two":"2"}'
- jar.delete('https://httpbin.test.k6.io/cookies', 'one');
- httpbinResp = http.get('https://httpbin.test.k6.io/cookies');
- console.log(JSON.stringify(httpbinResp.json().cookies));
+ jar.delete('https://quickpizza.grafana.com/api/cookies', 'one');
+ qpResp = http.get('https://quickpizza.grafana.com/api/cookies');
+ console.log(JSON.stringify(qpResp.json().cookies));
// Will print '{"three":"3","two":"2"}'
- jar.clear('https://httpbin.test.k6.io/cookies');
- httpbinResp = http.get('https://httpbin.test.k6.io/cookies');
- console.log(JSON.stringify(httpbinResp.json().cookies));
+ jar.clear('https://quickpizza.grafana.com/api/cookies');
+ qpResp = http.get('https://quickpizza.grafana.com/api/cookies');
+ console.log(JSON.stringify(qpResp.json().cookies));
// Will print '{}'
}
```
diff --git a/docs/sources/k6/v0.55.x/javascript-api/k6-http/cookiejar/cookiejar-cookiesforurl.md b/docs/sources/k6/v0.55.x/javascript-api/k6-http/cookiejar/cookiejar-cookiesforurl.md
index 533a0ad038..3f058e0112 100644
--- a/docs/sources/k6/v0.55.x/javascript-api/k6-http/cookiejar/cookiejar-cookiesforurl.md
+++ b/docs/sources/k6/v0.55.x/javascript-api/k6-http/cookiejar/cookiejar-cookiesforurl.md
@@ -24,11 +24,11 @@ import http from 'k6/http';
import { check } from 'k6';
export default function () {
- const res = http.get('https://httpbin.test.k6.io/cookies/set?my_cookie=hello%20world', {
+ const res = http.post('https://quickpizza.grafana.com/api/cookies?my_cookie=hello%20world', {
redirects: 0,
});
const jar = http.cookieJar();
- const cookies = jar.cookiesForURL('https://httpbin.test.k6.io/');
+ const cookies = jar.cookiesForURL('https://quickpizza.grafana.com/api/cookies');
check(res, {
"has cookie 'my_cookie'": (r) => cookies.my_cookie.length > 0,
'cookie has correct value': (r) => cookies.my_cookie[0] === 'hello world',
diff --git a/docs/sources/k6/v0.55.x/javascript-api/k6-http/cookiejar/cookiejar-delete.md b/docs/sources/k6/v0.55.x/javascript-api/k6-http/cookiejar/cookiejar-delete.md
index 558dc1c24d..932f3d3238 100644
--- a/docs/sources/k6/v0.55.x/javascript-api/k6-http/cookiejar/cookiejar-delete.md
+++ b/docs/sources/k6/v0.55.x/javascript-api/k6-http/cookiejar/cookiejar-delete.md
@@ -20,10 +20,10 @@ import { check } from 'k6';
export default function () {
const jar = http.cookieJar();
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie_1', 'hello world_1');
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie_2', 'hello world_2');
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'my_cookie_1', 'hello world_1');
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'my_cookie_2', 'hello world_2');
- const res1 = http.get('https://httpbin.test.k6.io/cookies');
+ const res1 = http.get('https://quickpizza.grafana.com/api/cookies');
check(res1, {
'res1 has status 200': (r) => r.status === 200,
"res1 has cookie 'my_cookie_1'": (r) => r.json().cookies.my_cookie_1 !== null,
@@ -32,9 +32,9 @@ export default function () {
'res1 cookie has correct value_2': (r) => r.json().cookies.my_cookie_2 == 'hello world_2',
});
- jar.delete('https://httpbin.test.k6.io/cookies', 'my_cookie_1');
+ jar.delete('https://quickpizza.grafana.com/api/cookies', 'my_cookie_1');
- const res2 = http.get('https://httpbin.test.k6.io/cookies');
+ const res2 = http.get('https://quickpizza.grafana.com/api/cookies');
check(res2, {
'res2 has status 200': (r) => r.status === 200,
"res2 doesn't have cookie 'my_cookie_1'": (r) => r.json().cookies.my_cookie_1 == null,
diff --git a/docs/sources/k6/v0.55.x/javascript-api/k6-http/cookiejar/cookiejar-set.md b/docs/sources/k6/v0.55.x/javascript-api/k6-http/cookiejar/cookiejar-set.md
index 170fb114ae..6f1de5a28f 100644
--- a/docs/sources/k6/v0.55.x/javascript-api/k6-http/cookiejar/cookiejar-set.md
+++ b/docs/sources/k6/v0.55.x/javascript-api/k6-http/cookiejar/cookiejar-set.md
@@ -24,13 +24,14 @@ import { check } from 'k6';
export default function () {
const jar = http.cookieJar();
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie', 'hello world', {
- domain: 'httpbin.test.k6.io',
- path: '/cookies',
+ jar.set('http://quickpizza.grafana.com', 'my_cookie', 'hello world', {
+ domain: 'quickpizza.grafana.com',
+ path: '/api/cookies',
secure: true,
max_age: 600,
});
- const res = http.get('https://httpbin.test.k6.io/cookies');
+ const res = http.get('https://quickpizza.grafana.com/api/cookies');
+ console.log(res.body);
check(res, {
'has status 200': (r) => r.status === 200,
"has cookie 'my_cookie'": (r) => r.json().cookies.my_cookie !== null,
diff --git a/docs/sources/k6/v0.55.x/javascript-api/k6-http/del.md b/docs/sources/k6/v0.55.x/javascript-api/k6-http/del.md
index 8a2327025c..b02862e82a 100644
--- a/docs/sources/k6/v0.55.x/javascript-api/k6-http/del.md
+++ b/docs/sources/k6/v0.55.x/javascript-api/k6-http/del.md
@@ -28,7 +28,7 @@ Make a DELETE request.
```javascript
import http from 'k6/http';
-const url = 'https://httpbin.test.k6.io/delete';
+const url = 'https://quickpizza.grafana.com/api/delete';
export default function () {
const params = { headers: { 'X-MyHeader': 'k6test' } };
diff --git a/docs/sources/k6/v0.55.x/javascript-api/k6-http/expected-statuses.md b/docs/sources/k6/v0.55.x/javascript-api/k6-http/expected-statuses.md
index 4912667f2e..d983b1098c 100644
--- a/docs/sources/k6/v0.55.x/javascript-api/k6-http/expected-statuses.md
+++ b/docs/sources/k6/v0.55.x/javascript-api/k6-http/expected-statuses.md
@@ -30,7 +30,7 @@ http.setResponseCallback(
export default () => {
// this one will actually be marked as failed as it doesn't match any of the above listed status
// codes
- http.get('https://httpbin.test.k6.io/status/205');
+ http.get('https://quickpizza.grafana.com/api/status/205');
};
```
diff --git a/docs/sources/k6/v0.55.x/javascript-api/k6-http/options.md b/docs/sources/k6/v0.55.x/javascript-api/k6-http/options.md
index bfe15af36b..6d7d78bfa1 100644
--- a/docs/sources/k6/v0.55.x/javascript-api/k6-http/options.md
+++ b/docs/sources/k6/v0.55.x/javascript-api/k6-http/options.md
@@ -26,7 +26,7 @@ weight: 10
```javascript
import http from 'k6/http';
-const url = 'https://httpbin.test.k6.io/';
+const url = 'https://quickpizza.grafana.com/';
export default function () {
const params = { headers: { 'X-MyHeader': 'k6test' } };
diff --git a/docs/sources/k6/v0.55.x/javascript-api/k6-http/params.md b/docs/sources/k6/v0.55.x/javascript-api/k6-http/params.md
index 122dabf05c..f8ead90919 100644
--- a/docs/sources/k6/v0.55.x/javascript-api/k6-http/params.md
+++ b/docs/sources/k6/v0.55.x/javascript-api/k6-http/params.md
@@ -53,8 +53,8 @@ Here is another example using [http.batch()](https://grafana.com/docs/k6/}}
-### Example of Digest Authentication
-
-Here is one example of how to use the `Params` to Digest Authentication.
-
-{{< code >}}
-
-```javascript
-import http from 'k6/http';
-import { check } from 'k6';
-
-export default function () {
- // Passing username and password as part of URL plus the auth option will authenticate using HTTP Digest authentication
- const res = http.get('http://user:passwd@httpbin.test.k6.io/digest-auth/auth/user/passwd', {
- auth: 'digest',
- });
-
- // Verify response
- check(res, {
- 'status is 200': (r) => r.status === 200,
- 'is authenticated': (r) => r.json().authenticated === true,
- 'is correct user': (r) => r.json().user === 'user',
- });
-}
-```
-
-{{< /code >}}
-
### Example of overriding discardResponseBodies
{{< code >}}
@@ -110,7 +83,7 @@ export default function () {}
export function setup() {
// Get 10 random bytes as an ArrayBuffer. Without the responseType the body
// will be null.
- const response = http.get('https://httpbin.test.k6.io/bytes/10', {
+ const response = http.get('https://quickpizza.grafana.com/api/bytes/10', {
responseType: 'binary',
});
// response.body is an ArrayBuffer, so wrap it in a typed array view to access
diff --git a/docs/sources/k6/v0.55.x/javascript-api/k6-http/patch.md b/docs/sources/k6/v0.55.x/javascript-api/k6-http/patch.md
index 81de685c9c..ec1cd71b1f 100644
--- a/docs/sources/k6/v0.55.x/javascript-api/k6-http/patch.md
+++ b/docs/sources/k6/v0.55.x/javascript-api/k6-http/patch.md
@@ -26,7 +26,7 @@ weight: 10
```javascript
import http from 'k6/http';
-const url = 'https://httpbin.test.k6.io/patch';
+const url = 'https://quickpizza.grafana.com/api/patch';
export default function () {
const headers = { 'Content-Type': 'application/json' };
@@ -34,7 +34,7 @@ export default function () {
const res = http.patch(url, JSON.stringify(data), { headers: headers });
- console.log(JSON.parse(res.body).json.name);
+ console.log(JSON.parse(res.body).name);
}
```
diff --git a/docs/sources/k6/v0.55.x/javascript-api/k6-http/post.md b/docs/sources/k6/v0.55.x/javascript-api/k6-http/post.md
index 2f1dfb0dfb..77fe3c8df0 100644
--- a/docs/sources/k6/v0.55.x/javascript-api/k6-http/post.md
+++ b/docs/sources/k6/v0.55.x/javascript-api/k6-http/post.md
@@ -23,10 +23,12 @@ weight: 10
{{< code >}}
+
+
```javascript
import http from 'k6/http';
-const url = 'https://httpbin.test.k6.io/post';
+const url = 'https://quickpizza.grafana.com/api/json';
const logoBin = open('./logo.png', 'b');
export default function () {
diff --git a/docs/sources/k6/v0.55.x/javascript-api/k6-http/put.md b/docs/sources/k6/v0.55.x/javascript-api/k6-http/put.md
index 5b5f2a7653..9d26cbda82 100644
--- a/docs/sources/k6/v0.55.x/javascript-api/k6-http/put.md
+++ b/docs/sources/k6/v0.55.x/javascript-api/k6-http/put.md
@@ -26,7 +26,7 @@ weight: 10
```javascript
import http from 'k6/http';
-const url = 'https://httpbin.test.k6.io/put';
+const url = 'https://quickpizza.grafana.com/api/put';
export default function () {
const headers = { 'Content-Type': 'application/json' };
@@ -34,7 +34,7 @@ export default function () {
const res = http.put(url, JSON.stringify(data), { headers: headers });
- console.log(JSON.parse(res.body).json.name);
+ console.log(JSON.parse(res.body).name);
}
```
diff --git a/docs/sources/k6/v0.55.x/javascript-api/k6-http/request.md b/docs/sources/k6/v0.55.x/javascript-api/k6-http/request.md
index 4766ae22bb..b541bf2997 100644
--- a/docs/sources/k6/v0.55.x/javascript-api/k6-http/request.md
+++ b/docs/sources/k6/v0.55.x/javascript-api/k6-http/request.md
@@ -29,7 +29,7 @@ Using http.request() to issue a POST request:
```javascript
import http from 'k6/http';
-const url = 'https://httpbin.test.k6.io/post';
+const url = 'https://quickpizza.grafana.com/api/post';
export default function () {
const data = { name: 'Bert' };
@@ -38,12 +38,12 @@ export default function () {
let res = http.request('POST', url, JSON.stringify(data), {
headers: { 'Content-Type': 'application/json' },
});
- console.log(res.json().json.name); // Bert
+ console.log(res.json().name); // Bert
// Using an object as body, the headers will automatically include
// 'Content-Type: application/x-www-form-urlencoded'.
res = http.request('POST', url, data);
- console.log(res.json().form.name); // Bert
+ console.log(res.body); // name=Bert
}
```
diff --git a/docs/sources/k6/v0.55.x/javascript-api/k6-http/response/response-clicklink---params.md b/docs/sources/k6/v0.55.x/javascript-api/k6-http/response/response-clicklink---params.md
index 1f9ac592c4..e0d55694b2 100644
--- a/docs/sources/k6/v0.55.x/javascript-api/k6-http/response/response-clicklink---params.md
+++ b/docs/sources/k6/v0.55.x/javascript-api/k6-http/response/response-clicklink---params.md
@@ -30,10 +30,10 @@ import http from 'k6/http';
export default function () {
// Request page with links
- let res = http.get('https://httpbin.test.k6.io/links/10/0');
+ let res = http.get('https://quickpizza.grafana.com/admin');
// Now, click the 4th link on the page
- res = res.clickLink({ selector: 'a:nth-child(4)' });
+ res = res.clickLink({ selector: 'a:nth-child(1)' });
}
```
diff --git a/docs/sources/k6/v0.55.x/javascript-api/k6-http/response/response-submitform---params.md b/docs/sources/k6/v0.55.x/javascript-api/k6-http/response/response-submitform---params.md
index f482b034b5..a71b4d590a 100644
--- a/docs/sources/k6/v0.55.x/javascript-api/k6-http/response/response-submitform---params.md
+++ b/docs/sources/k6/v0.55.x/javascript-api/k6-http/response/response-submitform---params.md
@@ -33,12 +33,12 @@ import { sleep } from 'k6';
export default function () {
// Request page containing a form
- let res = http.get('https://httpbin.test.k6.io/forms/post');
+ let res = http.get('https://quickpizza.grafana.com/admin');
// Now, submit form setting/overriding some fields of the form
res = res.submitForm({
formSelector: 'form',
- fields: { custname: 'test', extradata: 'test2' },
+ fields: { username: 'test', password: 'test2' },
});
sleep(3);
}
diff --git a/docs/sources/k6/v0.55.x/javascript-api/k6-http/set-response-callback.md b/docs/sources/k6/v0.55.x/javascript-api/k6-http/set-response-callback.md
index 9a62e2d2eb..98407b94b3 100644
--- a/docs/sources/k6/v0.55.x/javascript-api/k6-http/set-response-callback.md
+++ b/docs/sources/k6/v0.55.x/javascript-api/k6-http/set-response-callback.md
@@ -41,10 +41,12 @@ const only300Callback = http.expectedStatuses(300);
export default () => {
// this will use the default response callback and be marked as successful
- http.get('https://httpbin.test.k6.io/status/200');
+ http.get('https://quickpizza.grafana.com/api/status/200');
// this will be marked as a failed request as it won't get the expected status code of 300
- http.get('https://httpbin.test.k6.io/status/200', { responseCallback: only300Callback });
+ http.get('https://quickpizza.grafana.com/api/status/200', {
+ responseCallback: only300Callback,
+ });
http.setResponseCallback(http.expectedStatuses(301));
// from here on for this VU only the 301 status code will be successful so on the next iteration of
diff --git a/docs/sources/k6/v0.55.x/javascript-api/k6/check.md b/docs/sources/k6/v0.55.x/javascript-api/k6/check.md
index 5a155583dc..4bf25a6b15 100644
--- a/docs/sources/k6/v0.55.x/javascript-api/k6/check.md
+++ b/docs/sources/k6/v0.55.x/javascript-api/k6/check.md
@@ -37,7 +37,7 @@ import http from 'k6/http';
import { check } from 'k6';
export default function () {
- const res = http.get('https://httpbin.test.k6.io');
+ const res = http.get('https://quickpizza.grafana.com/');
check(res, {
'response code was 200': (res) => res.status == 200,
});
@@ -55,12 +55,12 @@ import http from 'k6/http';
import { check, fail } from 'k6';
export default function () {
- const res = http.get('https://httpbin.test.k6.io');
+ const res = http.get('https://quickpizza.grafana.com/');
const checkOutput = check(
res,
{
'response code was 200': (res) => res.status == 200,
- 'body size was 1234 bytes': (res) => res.body.length == 1234,
+ 'body size was larger than 123 bytes': (res) => res.body.length > 123,
},
{ myTag: "I'm a tag" }
);
diff --git a/docs/sources/k6/v0.55.x/results-output/end-of-test/custom-summary.md b/docs/sources/k6/v0.55.x/results-output/end-of-test/custom-summary.md
index 8fe1078075..b402364bba 100644
--- a/docs/sources/k6/v0.55.x/results-output/end-of-test/custom-summary.md
+++ b/docs/sources/k6/v0.55.x/results-output/end-of-test/custom-summary.md
@@ -217,6 +217,8 @@ The output is a short XML file that reports whether the test thresholds failed.
{{< code >}}
+
+
```javascript
import http from 'k6/http';
@@ -260,6 +262,8 @@ You can also send the generated reports to a remote server (over any protocol th
{{< code >}}
+
+
```javascript
import http from 'k6/http';
@@ -271,7 +275,7 @@ export function handleSummary(data) {
console.log('Preparing the end-of-test summary...');
// Send the results to some remote server or trigger a hook
- const resp = http.post('https://httpbin.test.k6.io/anything', JSON.stringify(data));
+ const resp = http.post('https://quickpizza.grafana.com/api/post', JSON.stringify(data));
if (resp.status != 200) {
console.error('Could not send summary, got status ' + resp.status);
}
diff --git a/docs/sources/k6/v0.55.x/results-output/real-time/json.md b/docs/sources/k6/v0.55.x/results-output/real-time/json.md
index 1febba1a6c..8b337be42d 100644
--- a/docs/sources/k6/v0.55.x/results-output/real-time/json.md
+++ b/docs/sources/k6/v0.55.x/results-output/real-time/json.md
@@ -62,7 +62,7 @@ The JSON output has lines as follows:
{"type":"Metric","data":{"type":"gauge","contains":"default","tainted":null,"thresholds":[],"submetrics":null},"metric":"vus"}
{"type":"Point","data":{"time":"2017-05-09T14:34:45.625742514+02:00","value":5,"tags":null},"metric":"vus"}
{"type":"Metric","data":{"type":"trend","contains":"time","tainted":null,"thresholds":["avg<1000"],"submetrics":null},"metric":"http_req_duration"}
-{"type":"Point","data":{"time":"2017-05-09T14:34:45.239531499+02:00","value":459.865729,"tags":{"group":"::my group::json","method":"GET","status":"200","url":"https://httpbin.test.k6.io/get"}},"metric":"http_req_duration"}
+{"type":"Point","data":{"time":"2017-05-09T14:34:45.239531499+02:00","value":459.865729,"tags":{"group":"::my group::json","method":"GET","status":"200","url":"https://quickpizza.grafana.com/api/tools"}},"metric":"http_req_duration"}
```
{{< /code >}}
diff --git a/docs/sources/k6/v0.55.x/testing-guides/api-load-testing.md b/docs/sources/k6/v0.55.x/testing-guides/api-load-testing.md
index 91ca308f90..b5dba6e323 100644
--- a/docs/sources/k6/v0.55.x/testing-guides/api-load-testing.md
+++ b/docs/sources/k6/v0.55.x/testing-guides/api-load-testing.md
@@ -43,7 +43,7 @@ export default function () {
surname: 'ipsum',
});
const headers = { 'Content-Type': 'application/json' };
- http.post('https://httpbin.test.k6.io/post', payload, { headers });
+ http.post('https://quickpizza.grafana.com/api/post', payload, { headers });
}
```
@@ -133,7 +133,7 @@ export default function () {
surname: 'ipsum',
});
const headers = { 'Content-Type': 'application/json' };
- http.post('https://httpbin.test.k6.io/post', payload, { headers });
+ http.post('https://quickpizza.grafana.com/api/post', payload, { headers });
}
```
@@ -181,7 +181,7 @@ export default function () {
surname: 'ipsum',
});
const headers = { 'Content-Type': 'application/json' };
- http.post('https://httpbin.test.k6.io/post', payload, { headers });
+ http.post('https://quickpizza.grafana.com/api/post', payload, { headers });
}
```
@@ -256,12 +256,12 @@ export default function () {
surname: 'ipsum',
});
const headers = { 'Content-Type': 'application/json' };
- const res = http.post('https://httpbin.test.k6.io/post', payload, { headers });
+ const res = http.post('https://quickpizza.grafana.com/api/post', payload, { headers });
check(res, {
'Post status is 200': (r) => res.status === 200,
'Post Content-Type header': (r) => res.headers['Content-Type'] === 'application/json',
- 'Post response name': (r) => res.status === 200 && res.json().json.name === 'lorem',
+ 'Post response name': (r) => res.status === 200 && res.json().name === 'lorem',
});
}
```
@@ -310,6 +310,8 @@ To ensure your system achieves its SLOs, test them frequently, both in pre-produ
In k6, you can use [Thresholds](https://grafana.com/docs/k6//using-k6/thresholds) to set the test pass/fail criteria.
This script codifies two SLOs in the `thresholds` object, one about error rate (availability) and one about request duration (latency).
+
+
```javascript
export const options = {
thresholds: {
@@ -402,6 +404,8 @@ For example, consider a JSON file with a list of user info such as:
You can parameterize the users with the [`SharedArray`](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) object as follows:
+
+
```javascript
import { check } from 'k6';
import http from 'k6/http';
@@ -422,14 +426,14 @@ export default function () {
});
const headers = { 'Content-Type': 'application/json' };
- const res = http.post('https://httpbin.test.k6.io/post', payload, {
+ const res = http.post('https://quickpizza.grafana.com/api/post', payload, {
headers,
});
check(res, {
'Post status is 200': (r) => res.status === 200,
'Post Content-Type header': (r) => res.headers['Content-Type'] === 'application/json',
- 'Post response name': (r) => res.status === 200 && res.json().json.name === user.username,
+ 'Post response name': (r) => res.status === 200 && res.json().name === user.username,
});
}
```
@@ -445,6 +449,8 @@ Though a test might be designed to induce failures, sometimes we focus on only t
The test script must handle API errors to avoid runtime exceptions and to ensure that it tests how the SUT behaves under saturation according to the test goals.
For example, we could extend our script to do some operation that depends on the result of the previous request:
+
+
```javascript
import { check } from 'k6';
import http from 'k6/http';
@@ -463,21 +469,21 @@ export default function () {
surname: user.surname,
});
const headers = { 'Content-Type': 'application/json' };
- const res = http.post('https://httpbin.test.k6.io/post', payload, {
+ const res = http.post('https://quickpizza.grafana.com/api/post', payload, {
headers,
});
check(res, {
'Post status is 200': (r) => res.status === 200,
'Post Content-Type header': (r) => res.headers['Content-Type'] === 'application/json',
- 'Post response name': (r) => res.status === 200 && res.json().json.name === user.username,
+ 'Post response name': (r) => res.status === 200 && res.json().name === user.username,
});
if (res.status === 200) {
// enters only successful responses
// otherwise, it triggers an exception
- const delPayload = JSON.stringify({ name: res.json().json.name });
- http.patch('https://httpbin.test.k6.io/patch', delPayload, { headers });
+ const delPayload = JSON.stringify({ name: res.json().name });
+ http.patch('https://quickpizza.grafana.com/api/patch', delPayload, { headers });
}
}
```
@@ -591,6 +597,8 @@ By default, k6 supports testing the following protocols:
- [Redis (experimental)](https://grafana.com/docs/k6//javascript-api/k6-experimental/redis/)
- [gRPC](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/)
+
+
```javascript
import grpc from 'k6/net/grpc';
import { check, sleep } from 'k6';
diff --git a/docs/sources/k6/v0.55.x/using-k6/cookies.md b/docs/sources/k6/v0.55.x/using-k6/cookies.md
index 183a7cbcd2..8008c67f37 100644
--- a/docs/sources/k6/v0.55.x/using-k6/cookies.md
+++ b/docs/sources/k6/v0.55.x/using-k6/cookies.md
@@ -42,7 +42,7 @@ in subsequent requests to the server, include the cookie in the `cookies` reques
import http from 'k6/http';
export default function () {
- http.get('https://httpbin.test.k6.io/cookies', {
+ http.get('https://quickpizza.grafana.com/api/cookies', {
cookies: {
my_cookie: 'hello world',
},
@@ -64,8 +64,8 @@ import http from 'k6/http';
export default function () {
const jar = http.cookieJar();
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie', 'hello world');
- http.get('https://httpbin.test.k6.io/cookies');
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'my_cookie', 'hello world');
+ http.get('https://quickpizza.grafana.com/api/cookies');
}
```
@@ -84,7 +84,7 @@ import { check } from 'k6';
export default function () {
const jar = http.cookieJar();
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie', 'hello world');
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'my_cookie', 'hello world');
const cookies = {
my_cookie: {
@@ -93,7 +93,7 @@ export default function () {
},
};
- const res = http.get('https://httpbin.test.k6.io/cookies', {
+ const res = http.get('https://quickpizza.grafana.com/api/cookies', {
cookies,
});
@@ -116,7 +116,7 @@ import http from 'k6/http';
import { check } from 'k6';
export default function () {
- const res = http.get('https://httpbin.test.k6.io/cookies/set?my_cookie=hello%20world', {
+ const res = http.post('https://quickpizza.grafana.com/api/cookies?my_cookie=hello%20world', {
redirects: 0,
});
check(res, {
@@ -159,11 +159,11 @@ import http from 'k6/http';
import { check } from 'k6';
export default function () {
- const res = http.get('https://httpbin.test.k6.io/cookies/set?my_cookie=hello%20world', {
+ const res = http.post('https://quickpizza.grafana.com/api/cookies?my_cookie=hello%20world', {
redirects: 0,
});
const jar = http.cookieJar();
- const cookies = jar.cookiesForURL('https://httpbin.test.k6.io/');
+ const cookies = jar.cookiesForURL('https://quickpizza.grafana.com/api/cookies');
check(res, {
"has cookie 'my_cookie'": (r) => cookies.my_cookie.length > 0,
'cookie has correct value': (r) => cookies.my_cookie[0] === 'hello world',
@@ -191,17 +191,17 @@ import { check } from 'k6';
export default function () {
const jar = http.cookieJar();
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie', 'hello world', {
- domain: 'httpbin.test.k6.io',
- path: '/cookies',
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'my_cookie', 'hello world', {
+ domain: 'quickpizza.grafana.com',
+ path: '/api/cookies',
secure: true,
max_age: 600,
});
- const res = http.get('https://httpbin.test.k6.io/cookies');
+ const res = http.get('https://quickpizza.grafana.com/api/cookies');
+
check(res, {
'has status 200': (r) => r.status === 200,
- "has cookie 'my_cookie'": (r) => r.cookies.my_cookie[0] !== null,
- 'cookie has correct value': (r) => r.cookies.my_cookie[0].value == 'hello world',
+ 'cookie has correct value': (r) => r.json().cookies.my_cookie == 'hello world',
});
}
```
@@ -224,19 +224,18 @@ export default function () {
// Add cookie to local jar
const cookieOptions = {
- domain: 'httpbin.test.k6.io',
- path: '/cookies',
+ domain: 'quickpizza.grafana.com',
+ path: '/api/cookies',
secure: true,
max_age: 600,
};
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie', 'hello world', cookieOptions);
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'my_cookie', 'hello world', cookieOptions);
// Override per-VU jar with local jar for the following request
- const res = http.get('https://httpbin.test.k6.io/cookies', { jar });
+ const res = http.get('https://quickpizza.grafana.com/api/cookies', { jar });
check(res, {
'has status 200': (r) => r.status === 200,
- "has cookie 'my_cookie'": (r) => r.cookies.my_cookie[0] !== null,
- 'cookie has correct value': (r) => r.cookies.my_cookie[0].value == 'hello world',
+ 'cookie has correct value': (r) => r.json().cookies.my_cookie == 'hello world',
});
}
```
diff --git a/docs/sources/k6/v0.55.x/using-k6/metrics/create-custom-metrics.md b/docs/sources/k6/v0.55.x/using-k6/metrics/create-custom-metrics.md
index 56d2cc0200..10e707f32a 100644
--- a/docs/sources/k6/v0.55.x/using-k6/metrics/create-custom-metrics.md
+++ b/docs/sources/k6/v0.55.x/using-k6/metrics/create-custom-metrics.md
@@ -29,6 +29,7 @@ This limits memory and ensures that k6 can validate that all thresholds are eval
The generic procedure to create a custom metric is as follows:
1. Import the [`k6/metrics`](https://grafana.com/docs/k6//javascript-api/k6-metrics) module. Optionally, specify the type of metrics you want to create with a named import:
+
```javascript
import { Trend } from 'k6/metrics';
@@ -37,6 +38,8 @@ The generic procedure to create a custom metric is as follows:
1. In init context, construct a new custom-metric object.
For example, the following creates a custom trend. The object in the script is called `myTrend`, and its metric appears in the results output as `waiting_time`.
+
+
```javascript
const myTrend = new Trend('waiting_time');
@@ -57,7 +60,7 @@ import { Trend } from 'k6/metrics';
const myTrend = new Trend('waiting_time');
export default function () {
- const r = http.get('https://httpbin.test.k6.io');
+ const r = http.get('https://quickpizza.grafana.com/');
myTrend.add(r.timings.waiting);
console.log(myTrend.name); // waiting_time
}
diff --git a/docs/sources/k6/v0.55.x/using-k6/scenarios/concepts/graceful-stop.md b/docs/sources/k6/v0.55.x/using-k6/scenarios/concepts/graceful-stop.md
index b828ac9390..e2002fda61 100644
--- a/docs/sources/k6/v0.55.x/using-k6/scenarios/concepts/graceful-stop.md
+++ b/docs/sources/k6/v0.55.x/using-k6/scenarios/concepts/graceful-stop.md
@@ -40,7 +40,7 @@ export const options = {
export default function () {
const delay = Math.floor(Math.random() * 5) + 1;
- http.get(`https://httpbin.test.k6.io/delay/${delay}`);
+ http.get(`https://quickpizza.grafana.com/api/delay/${delay}`);
}
```
diff --git a/docs/sources/k6/v0.55.x/using-k6/scenarios/concepts/open-vs-closed.md b/docs/sources/k6/v0.55.x/using-k6/scenarios/concepts/open-vs-closed.md
index 1fc96de47a..ab8e7e7799 100644
--- a/docs/sources/k6/v0.55.x/using-k6/scenarios/concepts/open-vs-closed.md
+++ b/docs/sources/k6/v0.55.x/using-k6/scenarios/concepts/open-vs-closed.md
@@ -46,7 +46,7 @@ export default function () {
// and we can expect to get 10 iterations completed in total for the
// full 1m test duration.
- http.get('https://httpbin.test.k6.io/delay/6');
+ http.get('https://quickpizza.grafana.com/api/delay/6');
}
```
@@ -113,7 +113,7 @@ export default function () {
// new VU iterations will start at a rate of 1 every second,
// and we can thus expect to get 60 iterations completed
// for the full 1m test duration.
- http.get('https://httpbin.test.k6.io/delay/6');
+ http.get('https://quickpizza.grafana.com/api/delay/6');
}
```
diff --git a/docs/sources/k6/v0.55.x/using-k6/tags-and-groups.md b/docs/sources/k6/v0.55.x/using-k6/tags-and-groups.md
index 77f3d96c57..cc56e00329 100644
--- a/docs/sources/k6/v0.55.x/using-k6/tags-and-groups.md
+++ b/docs/sources/k6/v0.55.x/using-k6/tags-and-groups.md
@@ -83,7 +83,7 @@ const myTrend = new Trend('my_trend');
export default function () {
// Add tag to request metric data
- const res = http.get('https://httpbin.test.k6.io/', {
+ const res = http.get('https://quickpizza.grafana.com/', {
tags: {
my_tag: "I'm a tag",
},
@@ -109,6 +109,7 @@ You can set these tags in two ways:
- In the script itself:
{{< code >}}
+
```javascript
export const options = {
@@ -128,6 +129,8 @@ To support advanced tagging workflows, it is also possible to directly set and g
[k6/execution.vu.tags](https://grafana.com/docs/k6//javascript-api/k6-execution/#vu) object's properties can indeed be directly assigned new key/value pairs to define new tags dynamically. This can prove useful, as demonstrated in the following example, to track a container's group from nested groups, and aggregating nested group's sub-metrics.
+
+
```javascript
import http from 'k6/http';
import exec from 'k6/execution';
@@ -146,14 +149,14 @@ export default function () {
group('main', function () {
http.get('https://test.k6.io');
group('sub', function () {
- http.get('https://httpbin.test.k6.io/anything');
+ http.get('https://quickpizza.grafana.com/');
});
http.get('https://test-api.k6.io');
});
delete exec.vu.tags.containerGroup;
- http.get('https://httpbin.test.k6.io/delay/3');
+ http.get('https://quickpizza.grafana.com/api/delay/3');
}
```
@@ -175,6 +178,8 @@ Similar to other tags tag, the tag is added to all samples collected during the
One way to tag the executed operations is to invoke the `tagWithCurrentStageIndex` function for setting a `stage` tag for identifying the stage that has executed them:
+
+
```javascript
import http from 'k6/http';
import exec from 'k6/execution';
@@ -182,8 +187,8 @@ import { tagWithCurrentStageIndex } from 'https://jslib.k6.io/k6-utils/1.3.0/ind
export const options = {
stages: [
- { target: 5, duration: '5s' },
- { target: 10, duration: '10s' },
+ { target: 5, duration: '2s' },
+ { target: 10, duration: '5s' },
],
};
@@ -198,13 +203,15 @@ export default function () {
Additionally, a profiling function `tagWithCurrentStageProfile` can add a tag with a computed profile of the current running stage:
+
+
```javascript
import http from 'k6/http';
import exec from 'k6/execution';
import { tagWithCurrentStageProfile } from 'https://jslib.k6.io/k6-utils/1.3.0/index.js';
export const options = {
- stages: [{ target: 10, duration: '10s' }],
+ stages: [{ target: 2, duration: '5s' }],
};
export default function () {
@@ -238,7 +245,7 @@ The profile value based on the current stage can be one of the following options
"group ": "::my group::json ",
"method ": "GET ",
"status ": "200 ",
- "url ": "https://httpbin.test.k6.io/get "
+ "url ": "http://quickpizza.grafana.com"
}
},
"metric ": "http_req_duration "
@@ -319,16 +326,18 @@ import http from 'k6/http';
const id = 5;
-// reconsider this type of code
-group('get post', function () {
- http.get(`http://example.com/posts/${id}`);
-});
-group('list posts', function () {
- const res = http.get(`http://example.com/posts`);
- check(res, {
- 'is status 200': (r) => r.status === 200,
+export default function () {
+ // reconsider this type of code
+ group('get post', function () {
+ http.get(`http://example.com/posts/${id}`);
});
-});
+ group('list posts', function () {
+ const res = http.get(`http://example.com/posts`);
+ check(res, {
+ 'is status 200': (r) => r.status === 200,
+ });
+ });
+}
```
{{< /code >}}
diff --git a/docs/sources/k6/v0.55.x/using-k6/test-lifecycle.md b/docs/sources/k6/v0.55.x/using-k6/test-lifecycle.md
index 46f612691c..02f91ce4f3 100644
--- a/docs/sources/k6/v0.55.x/using-k6/test-lifecycle.md
+++ b/docs/sources/k6/v0.55.x/using-k6/test-lifecycle.md
@@ -76,6 +76,8 @@ Code in the `init` context _always executes first_.
{{< code >}}
+
+
```javascript
// init context: importing modules
import http from 'k6/http';
@@ -152,7 +154,7 @@ For example, you can make HTTP requests:
import http from 'k6/http';
export function setup() {
- const res = http.get('https://httpbin.test.k6.io/get');
+ const res = http.get('https://quickpizza.grafana.com/api/json');
return { data: res.json() };
}
@@ -258,6 +260,7 @@ k6 has a few additional ways to use lifecycle functions:
- **Scenario functions**. Instead of the `default` function, you can also run VU code in scenario functions.
{{< code >}}
+
```javascript
import http from 'k6/http';
diff --git a/docs/sources/k6/v0.55.x/using-k6/thresholds.md b/docs/sources/k6/v0.55.x/using-k6/thresholds.md
index 9093546701..634f702bda 100644
--- a/docs/sources/k6/v0.55.x/using-k6/thresholds.md
+++ b/docs/sources/k6/v0.55.x/using-k6/thresholds.md
@@ -35,6 +35,8 @@ The other evaluates whether 95 percent of responses happen within a certain dura
{{< code >}}
+
+
```javascript
import http from 'k6/http';
@@ -79,6 +81,7 @@ and k6 would exit with a non-zero exit code.
To use a threshold, follow these steps:
1. In the `thresholds` property of the `options` object, set a key using the name of the metric you want the threshold for:
+
```javascript
export const options = {
@@ -92,6 +95,7 @@ To use a threshold, follow these steps:
- The short format puts all threshold expressions as strings in an array.
- The long format puts each threshold in an object, with extra properties to [abort on failure](#abort-a-test-when-a-threshold-is-crossed).
+
```javascript
export const options = {
@@ -148,26 +152,28 @@ setting different types of thresholds for each:
{{< code >}}
+
+
```javascript
import http from 'k6/http';
import { Trend, Rate, Counter, Gauge } from 'k6/metrics';
import { sleep } from 'k6';
export const TrendRTT = new Trend('RTT');
-export const RateContentOK = new Rate('Content OK');
+export const RateContentOK = new Rate('ContentOK');
export const GaugeContentSize = new Gauge('ContentSize');
export const CounterErrors = new Counter('Errors');
export const options = {
thresholds: {
// Count: Incorrect content cannot be returned more than 99 times.
- 'Errors': ['count<100'],
+ Errors: ['count<100'],
// Gauge: returned content must be smaller than 4000 bytes
- 'ContentSize': ['value<4000'],
+ ContentSize: ['value<4000'],
// Rate: content must be OK more than 95 times
- 'Content OK': ['rate>0.95'],
+ ContentOK: ['rate>0.95'],
// Trend: Percentiles, averages, medians, and minimums
// must be within specified milliseconds.
- 'RTT': ['p(99)<300', 'p(70)<250', 'avg<200', 'med<150', 'min<100'],
+ RTT: ['p(99)<300', 'p(70)<250', 'avg<200', 'med<150', 'min<100'],
},
};
@@ -196,6 +202,8 @@ Since thresholds are defined as the properties of a JavaScript object, you can't
{{< code >}}
+
+
```javascript
export const options = {
thresholds: {
@@ -298,6 +306,8 @@ For each group, there are different thresholds.
{{< code >}}
+
+
```javascript
import http from 'k6/http';
import { group, sleep } from 'k6';
@@ -337,6 +347,8 @@ export default function () {
It's often useful to specify thresholds on a single URL or specific tag.
In k6, tagged requests create sub-metrics that you can use in thresholds:
+
+
```javascript
export const options = {
thresholds: {
@@ -349,6 +361,8 @@ And here's a full example.
{{< code >}}
+
+
```javascript
import http from 'k6/http';
import { sleep } from 'k6';
@@ -398,6 +412,8 @@ After ten seconds, the test aborts if it fails the `p(99) < 10` threshold.
{{< code >}}
+
+
```javascript
export const options = {
thresholds: {
@@ -427,6 +443,8 @@ Here is an example:
{{< code >}}
+
+
```javascript
import http from 'k6/http';
@@ -476,7 +494,7 @@ export const options = {
};
export default function () {
- const res = http.get('https://httpbin.test.k6.io');
+ const res = http.get('https://quickpizza.grafana.com/api/status/500');
check(res, {
'status is 500': (r) => r.status == 500,
@@ -509,12 +527,12 @@ export const options = {
export default function () {
let res;
- res = http.get('https://httpbin.test.k6.io');
+ res = http.get('https://quickpizza.grafana.com/api/status/500');
check(res, {
'status is 500': (r) => r.status == 500,
});
- res = http.get('https://httpbin.test.k6.io');
+ res = http.get('https://quickpizza.grafana.com/api/status/200');
check(
res,
{
diff --git a/docs/sources/k6/v0.55.x/using-k6/workaround-iteration-duration.md b/docs/sources/k6/v0.55.x/using-k6/workaround-iteration-duration.md
index afcdec629f..408c161d1c 100644
--- a/docs/sources/k6/v0.55.x/using-k6/workaround-iteration-duration.md
+++ b/docs/sources/k6/v0.55.x/using-k6/workaround-iteration-duration.md
@@ -35,7 +35,7 @@ export const options = {
};
export function setup() {
- http.get('https://httpbin.test.k6.io/delay/5');
+ http.get('https://quickpizza.grafana.com/api/delay/5');
}
export default function () {
@@ -44,7 +44,7 @@ export default function () {
}
export function teardown() {
- http.get('https://httpbin.test.k6.io/delay/3');
+ http.get('https://quickpizza.grafana.com/api/delay/3');
sleep(5);
}
```
diff --git a/docs/sources/k6/v0.56.x/examples/cookies-example.md b/docs/sources/k6/v0.56.x/examples/cookies-example.md
index 81d65d9c14..213477412b 100644
--- a/docs/sources/k6/v0.56.x/examples/cookies-example.md
+++ b/docs/sources/k6/v0.56.x/examples/cookies-example.md
@@ -25,7 +25,7 @@ import { check, group } from 'k6';
export default function () {
// Since this request redirects the `res.cookies` property won't contain the cookies
- const res = http.get('https://httpbin.test.k6.io/cookies/set?name1=value1&name2=value2');
+ const res = http.post('https://quickpizza.grafana.com/api/cookies?name1=value1&name2=value2');
check(res, {
'status is 200': (r) => r.status === 200,
});
@@ -97,9 +97,9 @@ export default function () {
// that a request must match (domain, path, HTTPS or not etc.)
// to have the cookie attached to it when sent to the server.
const jar = http.cookieJar();
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie', 'hello world', {
- domain: 'httpbin.test.k6.io',
- path: '/cookies',
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'my_cookie', 'hello world', {
+ domain: 'quickpizza.grafana.com',
+ path: '/api/cookies',
secure: true,
max_age: 600,
});
@@ -107,7 +107,7 @@ export default function () {
// As the following request is matching the above cookie in terms of domain,
// path, HTTPS (secure) and will happen within the specified "age" limit, the
// cookie will be attached to this request.
- const res = http.get('https://httpbin.test.k6.io/cookies');
+ const res = http.get('https://quickpizza.grafana.com/api/cookies');
check(res, {
'has status 200': (r) => r.status === 200,
"has cookie 'my_cookie'": (r) => r.json().cookies.my_cookie !== null,
@@ -130,10 +130,10 @@ import { check } from 'k6';
export default function () {
const jar = http.cookieJar();
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie_1', 'hello world_1');
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie_2', 'hello world_2');
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'my_cookie_1', 'hello world_1');
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'my_cookie_2', 'hello world_2');
- const res1 = http.get('https://httpbin.test.k6.io/cookies');
+ const res1 = http.get('https://quickpizza.grafana.com/api/cookies');
check(res1, {
'res1 has status 200': (r) => r.status === 200,
"res1 has cookie 'my_cookie_1'": (r) => r.json().cookies.my_cookie_1 !== null,
@@ -142,9 +142,9 @@ export default function () {
'res1 cookie has correct value_2': (r) => r.json().cookies.my_cookie_2 == 'hello world_2',
});
- jar.delete('https://httpbin.test.k6.io/cookies', 'my_cookie_1');
+ jar.delete('https://quickpizza.grafana.com/api/cookies', 'my_cookie_1');
- const res2 = http.get('https://httpbin.test.k6.io/cookies');
+ const res2 = http.get('https://quickpizza.grafana.com/api/cookies');
check(res2, {
'res2 has status 200': (r) => r.status === 200,
"res2 hasn't cookie 'my_cookie_1'": (r) => r.json().cookies.my_cookie_1 == null,
@@ -168,17 +168,17 @@ import { check } from 'k6';
export default function () {
const jar = http.cookieJar();
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie', 'hello world');
- const res1 = http.get('https://httpbin.test.k6.io/cookies');
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'my_cookie', 'hello world');
+ const res1 = http.get('https://quickpizza.grafana.com/api/cookies');
check(res1, {
'has status 200': (r) => r.status === 200,
"has cookie 'my_cookie'": (r) => r.json().cookies.my_cookie !== null,
'cookie has correct value': (r) => r.json().cookies.my_cookie == 'hello world',
});
- jar.clear('https://httpbin.test.k6.io/cookies');
+ jar.clear('https://quickpizza.grafana.com/api/cookies');
- const res2 = http.get('https://httpbin.test.k6.io/cookies');
+ const res2 = http.get('https://quickpizza.grafana.com/api/cookies');
check(res2, {
'has status 200': (r) => r.status === 200,
"hasn't cookie 'my_cookie'": (r) => r.json().cookies.my_cookie == null,
diff --git a/docs/sources/k6/v0.56.x/examples/correlation-and-dynamic-data.md b/docs/sources/k6/v0.56.x/examples/correlation-and-dynamic-data.md
index d5cbe1dd9f..8f51909b58 100644
--- a/docs/sources/k6/v0.56.x/examples/correlation-and-dynamic-data.md
+++ b/docs/sources/k6/v0.56.x/examples/correlation-and-dynamic-data.md
@@ -40,18 +40,23 @@ import { check } from 'k6';
export default function () {
// Make a request that returns some JSON data
- const res = http.get('https://httpbin.test.k6.io/json');
+ const reqHeaders = {
+ Authorization: 'Token abcdef0123456789',
+ };
+ const res = http.get('https://quickpizza.grafana.com/api/doughs', {
+ headers: reqHeaders,
+ });
// Extract data from that JSON data by first parsing it
// using a call to "json()" and then accessing properties by
// navigating the JSON data as a JS object with dot notation.
- const slide1 = res.json().slideshow.slides[0];
- check(slide1, {
- 'slide 1 has correct title': (s) => s.title === 'Wake up to WonderWidgets!',
- 'slide 1 has correct type': (s) => s.type === 'all',
+ const dough1 = res.json().doughs[0];
+ check(dough1, {
+ 'dough1 1 has correct name': (s) => s.name === 'Thin',
+ 'dough1 1 has correct ID': (s) => s.ID === 1,
});
- // Now we could use the "slide1" variable in subsequent requests...
+ // Now we could use the "dough1" variable in subsequent requests...
}
```
@@ -130,13 +135,13 @@ import http from 'k6/http';
export default function () {
// This request returns XML:
- const res = http.get('https://httpbin.test.k6.io/xml');
+ const res = http.get('https://quickpizza.grafana.com/api/xml?color=green');
- // Use findBetween to extract the first title encountered:
- const title = findBetween(res.body, '', '');
+ // Use findBetween to extract the first tag encountered:
+ const color = findBetween(res.body, '', '');
- check(title, {
- 'title is correct': (t) => t === 'Wake up to WonderWidgets!',
+ check(color, {
+ 'color is correct': (t) => t === 'green',
});
}
```
diff --git a/docs/sources/k6/v0.56.x/examples/data-uploads.md b/docs/sources/k6/v0.56.x/examples/data-uploads.md
index 211cb8cc2c..f02d0b5a7b 100644
--- a/docs/sources/k6/v0.56.x/examples/data-uploads.md
+++ b/docs/sources/k6/v0.56.x/examples/data-uploads.md
@@ -128,7 +128,7 @@ export default function () {
fd.append('images', http.file(img2, 'image2.jpg', 'image/jpeg'));
fd.append('text', http.file(txt, 'text.txt', 'text/plain'));
- const res = http.post('https://httpbin.test.k6.io/post', fd.body(), {
+ const res = http.post('https://quickpizza.grafana.com/api/post', fd.body(), {
headers: { 'Content-Type': 'multipart/form-data; boundary=' + fd.boundary },
});
check(res, {
@@ -148,3 +148,5 @@ Note that:
- Blob is not supported or implemented. For the same functionality, use
a simple object with the fields `data`, `content_type` (defaulting to "application/octet-stream") and optionally
`filename` as shown for `aBinaryFile` above.
+
+
diff --git a/docs/sources/k6/v0.56.x/examples/get-timings-for-an-http-metric.md b/docs/sources/k6/v0.56.x/examples/get-timings-for-an-http-metric.md
index 03a4645836..bc30c60bca 100644
--- a/docs/sources/k6/v0.56.x/examples/get-timings-for-an-http-metric.md
+++ b/docs/sources/k6/v0.56.x/examples/get-timings-for-an-http-metric.md
@@ -27,7 +27,7 @@ This script gets the request duration timing for a specific GET request and logs
import http from 'k6/http';
export default function () {
- const res = http.get('https://httpbin.test.k6.io');
+ const res = http.get('https://quickpizza.grafana.com/');
console.log('Response time was ' + String(res.timings.duration) + ' ms');
}
```
diff --git a/docs/sources/k6/v0.56.x/examples/html-forms.md b/docs/sources/k6/v0.56.x/examples/html-forms.md
index e640c3b040..68328be1b1 100644
--- a/docs/sources/k6/v0.56.x/examples/html-forms.md
+++ b/docs/sources/k6/v0.56.x/examples/html-forms.md
@@ -18,12 +18,12 @@ import { sleep } from 'k6';
export default function () {
// Request page containing a form
- let res = http.get('https://httpbin.test.k6.io/forms/post');
+ let res = http.get('https://quickpizza.grafana.com/admin');
// Now, submit form setting/overriding some fields of the form
res = res.submitForm({
formSelector: 'form',
- fields: { custname: 'test', extradata: 'test2' },
+ fields: { username: 'admin', password: 'admin' },
});
sleep(3);
}
diff --git a/docs/sources/k6/v0.56.x/examples/http-authentication.md b/docs/sources/k6/v0.56.x/examples/http-authentication.md
index 97fb2fc24d..da8385fb9f 100644
--- a/docs/sources/k6/v0.56.x/examples/http-authentication.md
+++ b/docs/sources/k6/v0.56.x/examples/http-authentication.md
@@ -25,7 +25,7 @@ export default function () {
// Passing username and password as part of the URL will
// allow us to authenticate using HTTP Basic Auth.
- const url = `https://${credentials}@httpbin.test.k6.io/basic-auth/${username}/${password}`;
+ const url = `https://${credentials}@quickpizza.grafana.com/api/basic-auth/${username}/${password}`;
let res = http.get(url);
@@ -45,9 +45,9 @@ export default function () {
},
};
- res = http.get(`https://httpbin.test.k6.io/basic-auth/${username}/${password}`, options);
+ res = http.get(`https://quickpizza.grafana.com/api/basic-auth/${username}/${password}`, options);
- // Verify response (checking the echoed data from the httpbin.test.k6.io
+ // Verify response (checking the echoed data from the QuickPizza
// basic auth test API endpoint)
check(res, {
'status is 200': (r) => r.status === 200,
@@ -59,40 +59,6 @@ export default function () {
{{< /code >}}
-## Digest authentication
-
-{{< code >}}
-
-```javascript
-import http from 'k6/http';
-import { check } from 'k6';
-
-const username = 'user';
-const password = 'passwd';
-
-export default function () {
- // Passing username and password as part of URL plus the auth option will
- // authenticate using HTTP Digest authentication.
- const credentials = `${username}:${password}`;
- const res = http.get(
- `https://${credentials}@httpbin.test.k6.io/digest-auth/auth/${username}/${password}`,
- {
- auth: 'digest',
- }
- );
-
- // Verify response (checking the echoed data from the httpbin.test.k6.io digest auth
- // test API endpoint)
- check(res, {
- 'status is 200': (r) => r.status === 200,
- 'is authenticated': (r) => r.json().authenticated === true,
- 'is correct user': (r) => r.json().user === username,
- });
-}
-```
-
-{{< /code >}}
-
## NTLM authentication
{{< code >}}
@@ -121,6 +87,8 @@ Here's an example script to demonstrate how to sign a request to fetch an object
{{< code >}}
+
+
```javascript
import http from 'k6/http';
import {
diff --git a/docs/sources/k6/v0.56.x/get-started/resources.md b/docs/sources/k6/v0.56.x/get-started/resources.md
index ca10a8a61e..ca383da5cc 100644
--- a/docs/sources/k6/v0.56.x/get-started/resources.md
+++ b/docs/sources/k6/v0.56.x/get-started/resources.md
@@ -32,7 +32,6 @@ If you need a place to learn k6 and test your scripts, you can use these playgro
- [test-api.k6.io](https://test-api.k6.io/). A simple REST and WebSocket web application. [grafana/test-api.k6.io](https://github.com/grafana/test-api.k6.io)
- [grafana/quickpizza](https://github.com/grafana/quickpizza). A simple demo web application.
-- [grafana/httpbin](https://github.com/grafana/httpbin). A simple HTTP Request & Response Service.
Note that these are shared testing environments - please avoid high-load tests. Alternatively, you can deploy and host them on your infrastructure and run the examples in the repository.
diff --git a/docs/sources/k6/v0.56.x/get-started/running-k6.md b/docs/sources/k6/v0.56.x/get-started/running-k6.md
index 59dd258153..2b7c357283 100644
--- a/docs/sources/k6/v0.56.x/get-started/running-k6.md
+++ b/docs/sources/k6/v0.56.x/get-started/running-k6.md
@@ -180,7 +180,7 @@ export const options = {
};
export default function () {
- const res = http.get('https://httpbin.test.k6.io/');
+ const res = http.get('https://quickpizza.grafana.com/');
check(res, { 'status was 200': (r) => r.status == 200 });
sleep(1);
}
diff --git a/docs/sources/k6/v0.56.x/javascript-api/jslib/httpx/asyncrequest.md b/docs/sources/k6/v0.56.x/javascript-api/jslib/httpx/asyncrequest.md
index 1dfd7aa0de..5f1fc7a0af 100644
--- a/docs/sources/k6/v0.56.x/javascript-api/jslib/httpx/asyncrequest.md
+++ b/docs/sources/k6/v0.56.x/javascript-api/jslib/httpx/asyncrequest.md
@@ -32,7 +32,7 @@ Note, this method returns a Promise. You must use the `await` keyword to resolve
import { Httpx } from 'https://jslib.k6.io/httpx/0.1.0/index.js';
const session = new Httpx({
- baseURL: 'https://httpbin.test.k6.io',
+ baseURL: 'https://quickpizza.grafana.com/api',
timeout: 20000, // 20s timeout.
});
diff --git a/docs/sources/k6/v0.56.x/javascript-api/jslib/httpx/delete.md b/docs/sources/k6/v0.56.x/javascript-api/jslib/httpx/delete.md
index 7b1a1499d9..5a21e413dc 100644
--- a/docs/sources/k6/v0.56.x/javascript-api/jslib/httpx/delete.md
+++ b/docs/sources/k6/v0.56.x/javascript-api/jslib/httpx/delete.md
@@ -29,7 +29,7 @@ weight: 14
import { Httpx } from 'https://jslib.k6.io/httpx/0.1.0/index.js';
const session = new Httpx({
- baseURL: 'https://httpbin.test.k6.io',
+ baseURL: 'https://quickpizza.grafana.com/api',
timeout: 20000, // 20s timeout.
});
diff --git a/docs/sources/k6/v0.56.x/javascript-api/jslib/httpx/head.md b/docs/sources/k6/v0.56.x/javascript-api/jslib/httpx/head.md
index 7cf0661111..74186e5c7e 100644
--- a/docs/sources/k6/v0.56.x/javascript-api/jslib/httpx/head.md
+++ b/docs/sources/k6/v0.56.x/javascript-api/jslib/httpx/head.md
@@ -29,12 +29,12 @@ weight: 16
import { Httpx } from 'https://jslib.k6.io/httpx/0.1.0/index.js';
const session = new Httpx({
- baseURL: 'https://httpbin.test.k6.io',
+ baseURL: 'https://quickpizza.grafana.com',
timeout: 20000, // 20s timeout.
});
export default function testSuite() {
- const resp = session.head(`/head`);
+ const resp = session.head(`/`);
console.log(resp.status);
}
```
diff --git a/docs/sources/k6/v0.56.x/javascript-api/jslib/httpx/options.md b/docs/sources/k6/v0.56.x/javascript-api/jslib/httpx/options.md
index d7310722aa..ed37f4f73a 100644
--- a/docs/sources/k6/v0.56.x/javascript-api/jslib/httpx/options.md
+++ b/docs/sources/k6/v0.56.x/javascript-api/jslib/httpx/options.md
@@ -29,12 +29,12 @@ weight: 15
import { Httpx } from 'https://jslib.k6.io/httpx/0.1.0/index.js';
const session = new Httpx({
- baseURL: 'https://httpbin.test.k6.io',
+ baseURL: 'https://quickpizza.grafana.com',
timeout: 20000, // 20s timeout.
});
export default function testSuite() {
- const resp = session.options(`/options`);
+ const resp = session.options(`/`);
console.log(resp.status);
}
```
diff --git a/docs/sources/k6/v0.56.x/javascript-api/jslib/httpx/patch.md b/docs/sources/k6/v0.56.x/javascript-api/jslib/httpx/patch.md
index c21488464f..29acadd260 100644
--- a/docs/sources/k6/v0.56.x/javascript-api/jslib/httpx/patch.md
+++ b/docs/sources/k6/v0.56.x/javascript-api/jslib/httpx/patch.md
@@ -30,7 +30,7 @@ weight: 13
import { Httpx } from 'https://jslib.k6.io/httpx/0.1.0/index.js';
const session = new Httpx({
- baseURL: 'https://httpbin.test.k6.io',
+ baseURL: 'https://quickpizza.grafana.com/api',
timeout: 20000, // 20s timeout.
});
diff --git a/docs/sources/k6/v0.56.x/javascript-api/jslib/httpx/put.md b/docs/sources/k6/v0.56.x/javascript-api/jslib/httpx/put.md
index b865d55225..2c519079ee 100644
--- a/docs/sources/k6/v0.56.x/javascript-api/jslib/httpx/put.md
+++ b/docs/sources/k6/v0.56.x/javascript-api/jslib/httpx/put.md
@@ -30,7 +30,7 @@ weight: 12
import { Httpx } from 'https://jslib.k6.io/httpx/0.1.0/index.js';
const session = new Httpx({
- baseURL: 'https://httpbin.test.k6.io',
+ baseURL: 'https://quickpizza.grafana.com/api',
timeout: 20000, // 20s timeout.
});
diff --git a/docs/sources/k6/v0.56.x/javascript-api/jslib/httpx/request.md b/docs/sources/k6/v0.56.x/javascript-api/jslib/httpx/request.md
index 774fc143b3..ec051467a1 100644
--- a/docs/sources/k6/v0.56.x/javascript-api/jslib/httpx/request.md
+++ b/docs/sources/k6/v0.56.x/javascript-api/jslib/httpx/request.md
@@ -33,7 +33,7 @@ Consider using specific methods for making common requests [get](https://grafana
import { Httpx } from 'https://jslib.k6.io/httpx/0.1.0/index.js';
const session = new Httpx({
- baseURL: 'https://httpbin.test.k6.io',
+ baseURL: 'https://quickpizza.grafana.com/api',
timeout: 20000, // 20s timeout.
});
diff --git a/docs/sources/k6/v0.56.x/javascript-api/jslib/httpx/trace.md b/docs/sources/k6/v0.56.x/javascript-api/jslib/httpx/trace.md
index 6057a953f6..5b396c4890 100644
--- a/docs/sources/k6/v0.56.x/javascript-api/jslib/httpx/trace.md
+++ b/docs/sources/k6/v0.56.x/javascript-api/jslib/httpx/trace.md
@@ -29,12 +29,12 @@ weight: 17
import { Httpx } from 'https://jslib.k6.io/httpx/0.1.0/index.js';
const session = new Httpx({
- baseURL: 'https://httpbin.test.k6.io',
+ baseURL: 'https://quickpizza.grafana.com',
timeout: 20000, // 20s timeout.
});
export default function testSuite() {
- const resp = session.trace(`/trace`);
+ const resp = session.trace(`/`);
console.log(resp.status);
}
```
diff --git a/docs/sources/k6/v0.56.x/javascript-api/jslib/utils/check.md b/docs/sources/k6/v0.56.x/javascript-api/jslib/utils/check.md
index 3ddb2fbc85..e3f09eb02f 100644
--- a/docs/sources/k6/v0.56.x/javascript-api/jslib/utils/check.md
+++ b/docs/sources/k6/v0.56.x/javascript-api/jslib/utils/check.md
@@ -39,7 +39,7 @@ function waitFor(delay) {
}
export default async function () {
- const res = http.get('https://httpbin.test.k6.io');
+ const res = http.get('https://quickpizza.grafana.com/');
const success = await check(res, {
'passing promise as a value': waitFor(1000),
diff --git a/docs/sources/k6/v0.56.x/javascript-api/k6-browser/browsercontext/setdefaultnavigationtimeout.md b/docs/sources/k6/v0.56.x/javascript-api/k6-browser/browsercontext/setdefaultnavigationtimeout.md
index ed1d41d63d..dd763ce1da 100644
--- a/docs/sources/k6/v0.56.x/javascript-api/k6-browser/browsercontext/setdefaultnavigationtimeout.md
+++ b/docs/sources/k6/v0.56.x/javascript-api/k6-browser/browsercontext/setdefaultnavigationtimeout.md
@@ -15,6 +15,8 @@ Sets the default maximum navigation timeout for [Page.goto()](https://grafana.co
{{< code >}}
+
+
```javascript
import { browser } from 'k6/browser';
@@ -37,7 +39,7 @@ export default async function () {
context.setDefaultNavigationTimeout(1000); // 1s
try {
- await page.goto('https://httpbin.test.k6.io/delay/5');
+ await page.goto('https://quickpizza.grafana.com/api/delay/5');
} finally {
await page.close();
}
diff --git a/docs/sources/k6/v0.56.x/javascript-api/k6-browser/response/json.md b/docs/sources/k6/v0.56.x/javascript-api/k6-browser/response/json.md
index 1c1aaa66c1..ecd7adea9d 100644
--- a/docs/sources/k6/v0.56.x/javascript-api/k6-browser/response/json.md
+++ b/docs/sources/k6/v0.56.x/javascript-api/k6-browser/response/json.md
@@ -37,10 +37,10 @@ export default async function () {
const page = await browser.newPage();
try {
- const res = await page.goto('https://httpbin.test.k6.io/json');
+ const res = await page.goto('https://quickpizza.grafana.com/api/json?foo=bar');
const json = await res.json();
- console.log(`json: ${JSON.stringify(json)}`); // json: {"slideshow":
+ console.log(`json: ${JSON.stringify(json)}`); // json: {"foo": "bar"}
} finally {
await page.close();
}
diff --git a/docs/sources/k6/v0.56.x/javascript-api/k6-data/sharedarray.md b/docs/sources/k6/v0.56.x/javascript-api/k6-data/sharedarray.md
index 5750ac52f5..4d1e00d48d 100644
--- a/docs/sources/k6/v0.56.x/javascript-api/k6-data/sharedarray.md
+++ b/docs/sources/k6/v0.56.x/javascript-api/k6-data/sharedarray.md
@@ -13,6 +13,8 @@ When a script requests an element, k6 gives a _copy_ of that element.
You must construct a `SharedArray` in the [`init` context](https://grafana.com/docs/k6//using-k6/test-lifecycle).
Its constructor takes a name for the `SharedArray` and a function that needs to return an array object itself:
+
+
```javascript
import { SharedArray } from 'k6/data';
@@ -49,6 +51,8 @@ This limitation will eventually be removed, but for now, the implication is that
{{< code >}}
+
+
```javascript
import { SharedArray } from 'k6/data';
@@ -79,6 +83,8 @@ To test this, we ran the following script on version v0.31.0 with 100 VUs.
{{< code >}}
+
+
```javascript
import { check } from 'k6';
import http from 'k6/http';
@@ -102,7 +108,7 @@ if (__ENV.SHARED === 'true') {
export default function () {
const iterationData = data[Math.floor(Math.random() * data.length)];
- const res = http.post('https://httpbin.test.k6.io/anything', JSON.stringify(iterationData), {
+ const res = http.post('https://quickpizza.grafana.com/api/post', JSON.stringify(iterationData), {
headers: { 'Content-type': 'application/json' },
});
check(res, { 'status 200': (r) => r.status === 200 });
diff --git a/docs/sources/k6/v0.56.x/javascript-api/k6-http/asyncrequest.md b/docs/sources/k6/v0.56.x/javascript-api/k6-http/asyncrequest.md
index 8b8ddf6d20..6734c97171 100644
--- a/docs/sources/k6/v0.56.x/javascript-api/k6-http/asyncrequest.md
+++ b/docs/sources/k6/v0.56.x/javascript-api/k6-http/asyncrequest.md
@@ -29,21 +29,20 @@ Using http.asyncRequest() to issue a POST request:
```javascript
import http from 'k6/http';
-const url = 'https://httpbin.test.k6.io/post';
+const url = 'https://quickpizza.grafana.com/api/post';
export default async function () {
const data = { name: 'Bert' };
// Using a JSON string as body
- let res = await http.asyncRequest('POST', url, JSON.stringify(data), {
+ const res = await http.asyncRequest('POST', url, JSON.stringify(data), {
headers: { 'Content-Type': 'application/json' },
});
- console.log(res.json().json.name); // Bert
+ console.log(res.json().name); // Bert
// Using an object as body, the headers will automatically include
// 'Content-Type: application/x-www-form-urlencoded'.
- res = await http.asyncRequest('POST', url, data);
- console.log(res.json().form.name); // Bert
+ await http.asyncRequest('POST', url, data);
}
```
@@ -57,9 +56,9 @@ Using `http.asyncRequest()` to issue multiple requests, then [Promise.race](http
import http from 'k6/http';
export default async () => {
- const urlOne = `https://httpbin.test.k6.io/delay/${randomInt(1, 5)}`;
- const urlTwo = `https://httpbin.test.k6.io/delay/${randomInt(1, 5)}`;
- const urlThree = `https://httpbin.test.k6.io/delay/${randomInt(1, 5)}`;
+ const urlOne = `https://quickpizza.grafana.com/api/delay/${randomInt(1, 5)}`;
+ const urlTwo = `https://quickpizza.grafana.com/api/delay/${randomInt(1, 5)}`;
+ const urlThree = `https://quickpizza.grafana.com/api/delay/${randomInt(1, 5)}`;
const one = http.asyncRequest('GET', urlOne);
const two = http.asyncRequest('GET', urlTwo);
diff --git a/docs/sources/k6/v0.56.x/javascript-api/k6-http/batch.md b/docs/sources/k6/v0.56.x/javascript-api/k6-http/batch.md
index a0d9ec5f29..752d898566 100644
--- a/docs/sources/k6/v0.56.x/javascript-api/k6-http/batch.md
+++ b/docs/sources/k6/v0.56.x/javascript-api/k6-http/batch.md
@@ -91,27 +91,25 @@ import { check } from 'k6';
export default function () {
const req1 = {
method: 'GET',
- url: 'https://httpbin.test.k6.io/get',
+ url: 'https://quickpizza.grafana.com/api/get',
};
const req2 = {
- method: 'GET',
- url: 'https://test.k6.io',
+ method: 'DELETE',
+ url: 'https://quickpizza.grafana.com/api/delete',
};
const req3 = {
method: 'POST',
- url: 'https://httpbin.test.k6.io/post',
- body: {
- hello: 'world!',
- },
+ url: 'https://quickpizza.grafana.com/api/post',
+ body: JSON.stringify({ hello: 'world!' }),
params: {
- headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
+ headers: { 'Content-Type': 'application/json' },
},
};
const responses = http.batch([req1, req2, req3]);
- // httpbin.test.k6.io should return our POST data in the response body, so
+ // QuickPizza should return our POST data in the response body, so
// we check the third response object to see that the POST worked.
check(responses[2], {
- 'form data OK': (res) => JSON.parse(res.body)['form']['hello'] == 'world!',
+ 'form data OK': (res) => JSON.parse(res.body)['hello'] == 'world!',
});
}
```
diff --git a/docs/sources/k6/v0.56.x/javascript-api/k6-http/cookiejar/_index.md b/docs/sources/k6/v0.56.x/javascript-api/k6-http/cookiejar/_index.md
index cb001cf382..616e58b8a6 100644
--- a/docs/sources/k6/v0.56.x/javascript-api/k6-http/cookiejar/_index.md
+++ b/docs/sources/k6/v0.56.x/javascript-api/k6-http/cookiejar/_index.md
@@ -22,19 +22,19 @@ import http from 'k6/http';
import { check } from 'k6';
export default function () {
- const res1 = http.get('https://httpbin.test.k6.io/cookies/set?my_cookie=hello%20world', {
+ const res1 = http.post('https://quickpizza.grafana.com/api/cookies?my_cookie=hello%20world', {
redirects: 0,
});
const jar = http.cookieJar();
- const cookies = jar.cookiesForURL('https://httpbin.test.k6.io/');
+ const cookies = jar.cookiesForURL('https://quickpizza.grafana.com/api/cookies');
check(res1, {
"has cookie 'my_cookie'": (r) => cookies.my_cookie.length > 0,
'cookie has correct value': (r) => cookies.my_cookie[0] === 'hello world',
});
- jar.clear('https://httpbin.test.k6.io/cookies');
+ jar.clear('https://quickpizza.grafana.com/api/cookies');
- const res2 = http.get('https://httpbin.test.k6.io/cookies');
+ const res2 = http.get('https://quickpizza.grafana.com/api/cookies');
check(res2, {
'has status 200': (r) => r.status === 200,
"hasn't cookie 'my_cookie'": (r) => r.json().cookies.my_cookie == null,
diff --git a/docs/sources/k6/v0.56.x/javascript-api/k6-http/cookiejar/cookiejar-clear.md b/docs/sources/k6/v0.56.x/javascript-api/k6-http/cookiejar/cookiejar-clear.md
index b0dcc88b01..ca8f0315a2 100644
--- a/docs/sources/k6/v0.56.x/javascript-api/k6-http/cookiejar/cookiejar-clear.md
+++ b/docs/sources/k6/v0.56.x/javascript-api/k6-http/cookiejar/cookiejar-clear.md
@@ -17,29 +17,29 @@ description: 'Delete all cookies for the given URL.'
import http from 'k6/http';
export default function () {
- http.get('https://httpbin.test.k6.io/cookies/set?one=1&two=2');
+ http.post('https://quickpizza.grafana.com/api/cookies?one=1&two=2');
- // We'll use httpbin's reflection to see what cookies we
+ // We'll use QuickPizza's cookie reflection to see what cookies we
// are actually sending to the server after every change
- let httpbinResp;
- httpbinResp = http.get('https://httpbin.test.k6.io/cookies');
- console.log(JSON.stringify(httpbinResp.json().cookies));
+ let qpResp;
+ qpResp = http.get('https://quickpizza.grafana.com/api/cookies');
+ console.log(JSON.stringify(qpResp.json().cookies));
// Will print '{"one":"1","two":"2"}'
const jar = http.cookieJar(); // get the VU specific jar
- jar.set('https://httpbin.test.k6.io/cookies', 'three', '3');
- httpbinResp = http.get('https://httpbin.test.k6.io/cookies');
- console.log(JSON.stringify(httpbinResp.json().cookies));
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'three', '3');
+ qpResp = http.get('https://quickpizza.grafana.com/api/cookies');
+ console.log(JSON.stringify(qpResp.json().cookies));
// Will print '{"one":"1","three":"3","two":"2"}'
- jar.delete('https://httpbin.test.k6.io/cookies', 'one');
- httpbinResp = http.get('https://httpbin.test.k6.io/cookies');
- console.log(JSON.stringify(httpbinResp.json().cookies));
+ jar.delete('https://quickpizza.grafana.com/api/cookies', 'one');
+ qpResp = http.get('https://quickpizza.grafana.com/api/cookies');
+ console.log(JSON.stringify(qpResp.json().cookies));
// Will print '{"three":"3","two":"2"}'
- jar.clear('https://httpbin.test.k6.io/cookies');
- httpbinResp = http.get('https://httpbin.test.k6.io/cookies');
- console.log(JSON.stringify(httpbinResp.json().cookies));
+ jar.clear('https://quickpizza.grafana.com/api/cookies');
+ qpResp = http.get('https://quickpizza.grafana.com/api/cookies');
+ console.log(JSON.stringify(qpResp.json().cookies));
// Will print '{}'
}
```
diff --git a/docs/sources/k6/v0.56.x/javascript-api/k6-http/cookiejar/cookiejar-cookiesforurl.md b/docs/sources/k6/v0.56.x/javascript-api/k6-http/cookiejar/cookiejar-cookiesforurl.md
index 533a0ad038..3f058e0112 100644
--- a/docs/sources/k6/v0.56.x/javascript-api/k6-http/cookiejar/cookiejar-cookiesforurl.md
+++ b/docs/sources/k6/v0.56.x/javascript-api/k6-http/cookiejar/cookiejar-cookiesforurl.md
@@ -24,11 +24,11 @@ import http from 'k6/http';
import { check } from 'k6';
export default function () {
- const res = http.get('https://httpbin.test.k6.io/cookies/set?my_cookie=hello%20world', {
+ const res = http.post('https://quickpizza.grafana.com/api/cookies?my_cookie=hello%20world', {
redirects: 0,
});
const jar = http.cookieJar();
- const cookies = jar.cookiesForURL('https://httpbin.test.k6.io/');
+ const cookies = jar.cookiesForURL('https://quickpizza.grafana.com/api/cookies');
check(res, {
"has cookie 'my_cookie'": (r) => cookies.my_cookie.length > 0,
'cookie has correct value': (r) => cookies.my_cookie[0] === 'hello world',
diff --git a/docs/sources/k6/v0.56.x/javascript-api/k6-http/cookiejar/cookiejar-delete.md b/docs/sources/k6/v0.56.x/javascript-api/k6-http/cookiejar/cookiejar-delete.md
index 558dc1c24d..932f3d3238 100644
--- a/docs/sources/k6/v0.56.x/javascript-api/k6-http/cookiejar/cookiejar-delete.md
+++ b/docs/sources/k6/v0.56.x/javascript-api/k6-http/cookiejar/cookiejar-delete.md
@@ -20,10 +20,10 @@ import { check } from 'k6';
export default function () {
const jar = http.cookieJar();
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie_1', 'hello world_1');
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie_2', 'hello world_2');
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'my_cookie_1', 'hello world_1');
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'my_cookie_2', 'hello world_2');
- const res1 = http.get('https://httpbin.test.k6.io/cookies');
+ const res1 = http.get('https://quickpizza.grafana.com/api/cookies');
check(res1, {
'res1 has status 200': (r) => r.status === 200,
"res1 has cookie 'my_cookie_1'": (r) => r.json().cookies.my_cookie_1 !== null,
@@ -32,9 +32,9 @@ export default function () {
'res1 cookie has correct value_2': (r) => r.json().cookies.my_cookie_2 == 'hello world_2',
});
- jar.delete('https://httpbin.test.k6.io/cookies', 'my_cookie_1');
+ jar.delete('https://quickpizza.grafana.com/api/cookies', 'my_cookie_1');
- const res2 = http.get('https://httpbin.test.k6.io/cookies');
+ const res2 = http.get('https://quickpizza.grafana.com/api/cookies');
check(res2, {
'res2 has status 200': (r) => r.status === 200,
"res2 doesn't have cookie 'my_cookie_1'": (r) => r.json().cookies.my_cookie_1 == null,
diff --git a/docs/sources/k6/v0.56.x/javascript-api/k6-http/cookiejar/cookiejar-set.md b/docs/sources/k6/v0.56.x/javascript-api/k6-http/cookiejar/cookiejar-set.md
index 170fb114ae..6f1de5a28f 100644
--- a/docs/sources/k6/v0.56.x/javascript-api/k6-http/cookiejar/cookiejar-set.md
+++ b/docs/sources/k6/v0.56.x/javascript-api/k6-http/cookiejar/cookiejar-set.md
@@ -24,13 +24,14 @@ import { check } from 'k6';
export default function () {
const jar = http.cookieJar();
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie', 'hello world', {
- domain: 'httpbin.test.k6.io',
- path: '/cookies',
+ jar.set('http://quickpizza.grafana.com', 'my_cookie', 'hello world', {
+ domain: 'quickpizza.grafana.com',
+ path: '/api/cookies',
secure: true,
max_age: 600,
});
- const res = http.get('https://httpbin.test.k6.io/cookies');
+ const res = http.get('https://quickpizza.grafana.com/api/cookies');
+ console.log(res.body);
check(res, {
'has status 200': (r) => r.status === 200,
"has cookie 'my_cookie'": (r) => r.json().cookies.my_cookie !== null,
diff --git a/docs/sources/k6/v0.56.x/javascript-api/k6-http/del.md b/docs/sources/k6/v0.56.x/javascript-api/k6-http/del.md
index 8a2327025c..b02862e82a 100644
--- a/docs/sources/k6/v0.56.x/javascript-api/k6-http/del.md
+++ b/docs/sources/k6/v0.56.x/javascript-api/k6-http/del.md
@@ -28,7 +28,7 @@ Make a DELETE request.
```javascript
import http from 'k6/http';
-const url = 'https://httpbin.test.k6.io/delete';
+const url = 'https://quickpizza.grafana.com/api/delete';
export default function () {
const params = { headers: { 'X-MyHeader': 'k6test' } };
diff --git a/docs/sources/k6/v0.56.x/javascript-api/k6-http/expected-statuses.md b/docs/sources/k6/v0.56.x/javascript-api/k6-http/expected-statuses.md
index 4912667f2e..d983b1098c 100644
--- a/docs/sources/k6/v0.56.x/javascript-api/k6-http/expected-statuses.md
+++ b/docs/sources/k6/v0.56.x/javascript-api/k6-http/expected-statuses.md
@@ -30,7 +30,7 @@ http.setResponseCallback(
export default () => {
// this one will actually be marked as failed as it doesn't match any of the above listed status
// codes
- http.get('https://httpbin.test.k6.io/status/205');
+ http.get('https://quickpizza.grafana.com/api/status/205');
};
```
diff --git a/docs/sources/k6/v0.56.x/javascript-api/k6-http/options.md b/docs/sources/k6/v0.56.x/javascript-api/k6-http/options.md
index bfe15af36b..6d7d78bfa1 100644
--- a/docs/sources/k6/v0.56.x/javascript-api/k6-http/options.md
+++ b/docs/sources/k6/v0.56.x/javascript-api/k6-http/options.md
@@ -26,7 +26,7 @@ weight: 10
```javascript
import http from 'k6/http';
-const url = 'https://httpbin.test.k6.io/';
+const url = 'https://quickpizza.grafana.com/';
export default function () {
const params = { headers: { 'X-MyHeader': 'k6test' } };
diff --git a/docs/sources/k6/v0.56.x/javascript-api/k6-http/params.md b/docs/sources/k6/v0.56.x/javascript-api/k6-http/params.md
index 122dabf05c..f8ead90919 100644
--- a/docs/sources/k6/v0.56.x/javascript-api/k6-http/params.md
+++ b/docs/sources/k6/v0.56.x/javascript-api/k6-http/params.md
@@ -53,8 +53,8 @@ Here is another example using [http.batch()](https://grafana.com/docs/k6/}}
-### Example of Digest Authentication
-
-Here is one example of how to use the `Params` to Digest Authentication.
-
-{{< code >}}
-
-```javascript
-import http from 'k6/http';
-import { check } from 'k6';
-
-export default function () {
- // Passing username and password as part of URL plus the auth option will authenticate using HTTP Digest authentication
- const res = http.get('http://user:passwd@httpbin.test.k6.io/digest-auth/auth/user/passwd', {
- auth: 'digest',
- });
-
- // Verify response
- check(res, {
- 'status is 200': (r) => r.status === 200,
- 'is authenticated': (r) => r.json().authenticated === true,
- 'is correct user': (r) => r.json().user === 'user',
- });
-}
-```
-
-{{< /code >}}
-
### Example of overriding discardResponseBodies
{{< code >}}
@@ -110,7 +83,7 @@ export default function () {}
export function setup() {
// Get 10 random bytes as an ArrayBuffer. Without the responseType the body
// will be null.
- const response = http.get('https://httpbin.test.k6.io/bytes/10', {
+ const response = http.get('https://quickpizza.grafana.com/api/bytes/10', {
responseType: 'binary',
});
// response.body is an ArrayBuffer, so wrap it in a typed array view to access
diff --git a/docs/sources/k6/v0.56.x/javascript-api/k6-http/patch.md b/docs/sources/k6/v0.56.x/javascript-api/k6-http/patch.md
index 81de685c9c..ec1cd71b1f 100644
--- a/docs/sources/k6/v0.56.x/javascript-api/k6-http/patch.md
+++ b/docs/sources/k6/v0.56.x/javascript-api/k6-http/patch.md
@@ -26,7 +26,7 @@ weight: 10
```javascript
import http from 'k6/http';
-const url = 'https://httpbin.test.k6.io/patch';
+const url = 'https://quickpizza.grafana.com/api/patch';
export default function () {
const headers = { 'Content-Type': 'application/json' };
@@ -34,7 +34,7 @@ export default function () {
const res = http.patch(url, JSON.stringify(data), { headers: headers });
- console.log(JSON.parse(res.body).json.name);
+ console.log(JSON.parse(res.body).name);
}
```
diff --git a/docs/sources/k6/v0.56.x/javascript-api/k6-http/post.md b/docs/sources/k6/v0.56.x/javascript-api/k6-http/post.md
index 2f1dfb0dfb..77fe3c8df0 100644
--- a/docs/sources/k6/v0.56.x/javascript-api/k6-http/post.md
+++ b/docs/sources/k6/v0.56.x/javascript-api/k6-http/post.md
@@ -23,10 +23,12 @@ weight: 10
{{< code >}}
+
+
```javascript
import http from 'k6/http';
-const url = 'https://httpbin.test.k6.io/post';
+const url = 'https://quickpizza.grafana.com/api/json';
const logoBin = open('./logo.png', 'b');
export default function () {
diff --git a/docs/sources/k6/v0.56.x/javascript-api/k6-http/put.md b/docs/sources/k6/v0.56.x/javascript-api/k6-http/put.md
index 5b5f2a7653..9d26cbda82 100644
--- a/docs/sources/k6/v0.56.x/javascript-api/k6-http/put.md
+++ b/docs/sources/k6/v0.56.x/javascript-api/k6-http/put.md
@@ -26,7 +26,7 @@ weight: 10
```javascript
import http from 'k6/http';
-const url = 'https://httpbin.test.k6.io/put';
+const url = 'https://quickpizza.grafana.com/api/put';
export default function () {
const headers = { 'Content-Type': 'application/json' };
@@ -34,7 +34,7 @@ export default function () {
const res = http.put(url, JSON.stringify(data), { headers: headers });
- console.log(JSON.parse(res.body).json.name);
+ console.log(JSON.parse(res.body).name);
}
```
diff --git a/docs/sources/k6/v0.56.x/javascript-api/k6-http/request.md b/docs/sources/k6/v0.56.x/javascript-api/k6-http/request.md
index 4766ae22bb..b541bf2997 100644
--- a/docs/sources/k6/v0.56.x/javascript-api/k6-http/request.md
+++ b/docs/sources/k6/v0.56.x/javascript-api/k6-http/request.md
@@ -29,7 +29,7 @@ Using http.request() to issue a POST request:
```javascript
import http from 'k6/http';
-const url = 'https://httpbin.test.k6.io/post';
+const url = 'https://quickpizza.grafana.com/api/post';
export default function () {
const data = { name: 'Bert' };
@@ -38,12 +38,12 @@ export default function () {
let res = http.request('POST', url, JSON.stringify(data), {
headers: { 'Content-Type': 'application/json' },
});
- console.log(res.json().json.name); // Bert
+ console.log(res.json().name); // Bert
// Using an object as body, the headers will automatically include
// 'Content-Type: application/x-www-form-urlencoded'.
res = http.request('POST', url, data);
- console.log(res.json().form.name); // Bert
+ console.log(res.body); // name=Bert
}
```
diff --git a/docs/sources/k6/v0.56.x/javascript-api/k6-http/response/response-clicklink---params.md b/docs/sources/k6/v0.56.x/javascript-api/k6-http/response/response-clicklink---params.md
index 1f9ac592c4..e0d55694b2 100644
--- a/docs/sources/k6/v0.56.x/javascript-api/k6-http/response/response-clicklink---params.md
+++ b/docs/sources/k6/v0.56.x/javascript-api/k6-http/response/response-clicklink---params.md
@@ -30,10 +30,10 @@ import http from 'k6/http';
export default function () {
// Request page with links
- let res = http.get('https://httpbin.test.k6.io/links/10/0');
+ let res = http.get('https://quickpizza.grafana.com/admin');
// Now, click the 4th link on the page
- res = res.clickLink({ selector: 'a:nth-child(4)' });
+ res = res.clickLink({ selector: 'a:nth-child(1)' });
}
```
diff --git a/docs/sources/k6/v0.56.x/javascript-api/k6-http/response/response-submitform---params.md b/docs/sources/k6/v0.56.x/javascript-api/k6-http/response/response-submitform---params.md
index f482b034b5..a71b4d590a 100644
--- a/docs/sources/k6/v0.56.x/javascript-api/k6-http/response/response-submitform---params.md
+++ b/docs/sources/k6/v0.56.x/javascript-api/k6-http/response/response-submitform---params.md
@@ -33,12 +33,12 @@ import { sleep } from 'k6';
export default function () {
// Request page containing a form
- let res = http.get('https://httpbin.test.k6.io/forms/post');
+ let res = http.get('https://quickpizza.grafana.com/admin');
// Now, submit form setting/overriding some fields of the form
res = res.submitForm({
formSelector: 'form',
- fields: { custname: 'test', extradata: 'test2' },
+ fields: { username: 'test', password: 'test2' },
});
sleep(3);
}
diff --git a/docs/sources/k6/v0.56.x/javascript-api/k6-http/set-response-callback.md b/docs/sources/k6/v0.56.x/javascript-api/k6-http/set-response-callback.md
index 9a62e2d2eb..98407b94b3 100644
--- a/docs/sources/k6/v0.56.x/javascript-api/k6-http/set-response-callback.md
+++ b/docs/sources/k6/v0.56.x/javascript-api/k6-http/set-response-callback.md
@@ -41,10 +41,12 @@ const only300Callback = http.expectedStatuses(300);
export default () => {
// this will use the default response callback and be marked as successful
- http.get('https://httpbin.test.k6.io/status/200');
+ http.get('https://quickpizza.grafana.com/api/status/200');
// this will be marked as a failed request as it won't get the expected status code of 300
- http.get('https://httpbin.test.k6.io/status/200', { responseCallback: only300Callback });
+ http.get('https://quickpizza.grafana.com/api/status/200', {
+ responseCallback: only300Callback,
+ });
http.setResponseCallback(http.expectedStatuses(301));
// from here on for this VU only the 301 status code will be successful so on the next iteration of
diff --git a/docs/sources/k6/v0.56.x/javascript-api/k6/check.md b/docs/sources/k6/v0.56.x/javascript-api/k6/check.md
index 5a155583dc..4bf25a6b15 100644
--- a/docs/sources/k6/v0.56.x/javascript-api/k6/check.md
+++ b/docs/sources/k6/v0.56.x/javascript-api/k6/check.md
@@ -37,7 +37,7 @@ import http from 'k6/http';
import { check } from 'k6';
export default function () {
- const res = http.get('https://httpbin.test.k6.io');
+ const res = http.get('https://quickpizza.grafana.com/');
check(res, {
'response code was 200': (res) => res.status == 200,
});
@@ -55,12 +55,12 @@ import http from 'k6/http';
import { check, fail } from 'k6';
export default function () {
- const res = http.get('https://httpbin.test.k6.io');
+ const res = http.get('https://quickpizza.grafana.com/');
const checkOutput = check(
res,
{
'response code was 200': (res) => res.status == 200,
- 'body size was 1234 bytes': (res) => res.body.length == 1234,
+ 'body size was larger than 123 bytes': (res) => res.body.length > 123,
},
{ myTag: "I'm a tag" }
);
diff --git a/docs/sources/k6/v0.56.x/results-output/end-of-test/custom-summary.md b/docs/sources/k6/v0.56.x/results-output/end-of-test/custom-summary.md
index 8fe1078075..b402364bba 100644
--- a/docs/sources/k6/v0.56.x/results-output/end-of-test/custom-summary.md
+++ b/docs/sources/k6/v0.56.x/results-output/end-of-test/custom-summary.md
@@ -217,6 +217,8 @@ The output is a short XML file that reports whether the test thresholds failed.
{{< code >}}
+
+
```javascript
import http from 'k6/http';
@@ -260,6 +262,8 @@ You can also send the generated reports to a remote server (over any protocol th
{{< code >}}
+
+
```javascript
import http from 'k6/http';
@@ -271,7 +275,7 @@ export function handleSummary(data) {
console.log('Preparing the end-of-test summary...');
// Send the results to some remote server or trigger a hook
- const resp = http.post('https://httpbin.test.k6.io/anything', JSON.stringify(data));
+ const resp = http.post('https://quickpizza.grafana.com/api/post', JSON.stringify(data));
if (resp.status != 200) {
console.error('Could not send summary, got status ' + resp.status);
}
diff --git a/docs/sources/k6/v0.56.x/results-output/real-time/json.md b/docs/sources/k6/v0.56.x/results-output/real-time/json.md
index 1febba1a6c..8b337be42d 100644
--- a/docs/sources/k6/v0.56.x/results-output/real-time/json.md
+++ b/docs/sources/k6/v0.56.x/results-output/real-time/json.md
@@ -62,7 +62,7 @@ The JSON output has lines as follows:
{"type":"Metric","data":{"type":"gauge","contains":"default","tainted":null,"thresholds":[],"submetrics":null},"metric":"vus"}
{"type":"Point","data":{"time":"2017-05-09T14:34:45.625742514+02:00","value":5,"tags":null},"metric":"vus"}
{"type":"Metric","data":{"type":"trend","contains":"time","tainted":null,"thresholds":["avg<1000"],"submetrics":null},"metric":"http_req_duration"}
-{"type":"Point","data":{"time":"2017-05-09T14:34:45.239531499+02:00","value":459.865729,"tags":{"group":"::my group::json","method":"GET","status":"200","url":"https://httpbin.test.k6.io/get"}},"metric":"http_req_duration"}
+{"type":"Point","data":{"time":"2017-05-09T14:34:45.239531499+02:00","value":459.865729,"tags":{"group":"::my group::json","method":"GET","status":"200","url":"https://quickpizza.grafana.com/api/tools"}},"metric":"http_req_duration"}
```
{{< /code >}}
diff --git a/docs/sources/k6/v0.56.x/testing-guides/api-load-testing.md b/docs/sources/k6/v0.56.x/testing-guides/api-load-testing.md
index 91ca308f90..b5dba6e323 100644
--- a/docs/sources/k6/v0.56.x/testing-guides/api-load-testing.md
+++ b/docs/sources/k6/v0.56.x/testing-guides/api-load-testing.md
@@ -43,7 +43,7 @@ export default function () {
surname: 'ipsum',
});
const headers = { 'Content-Type': 'application/json' };
- http.post('https://httpbin.test.k6.io/post', payload, { headers });
+ http.post('https://quickpizza.grafana.com/api/post', payload, { headers });
}
```
@@ -133,7 +133,7 @@ export default function () {
surname: 'ipsum',
});
const headers = { 'Content-Type': 'application/json' };
- http.post('https://httpbin.test.k6.io/post', payload, { headers });
+ http.post('https://quickpizza.grafana.com/api/post', payload, { headers });
}
```
@@ -181,7 +181,7 @@ export default function () {
surname: 'ipsum',
});
const headers = { 'Content-Type': 'application/json' };
- http.post('https://httpbin.test.k6.io/post', payload, { headers });
+ http.post('https://quickpizza.grafana.com/api/post', payload, { headers });
}
```
@@ -256,12 +256,12 @@ export default function () {
surname: 'ipsum',
});
const headers = { 'Content-Type': 'application/json' };
- const res = http.post('https://httpbin.test.k6.io/post', payload, { headers });
+ const res = http.post('https://quickpizza.grafana.com/api/post', payload, { headers });
check(res, {
'Post status is 200': (r) => res.status === 200,
'Post Content-Type header': (r) => res.headers['Content-Type'] === 'application/json',
- 'Post response name': (r) => res.status === 200 && res.json().json.name === 'lorem',
+ 'Post response name': (r) => res.status === 200 && res.json().name === 'lorem',
});
}
```
@@ -310,6 +310,8 @@ To ensure your system achieves its SLOs, test them frequently, both in pre-produ
In k6, you can use [Thresholds](https://grafana.com/docs/k6//using-k6/thresholds) to set the test pass/fail criteria.
This script codifies two SLOs in the `thresholds` object, one about error rate (availability) and one about request duration (latency).
+
+
```javascript
export const options = {
thresholds: {
@@ -402,6 +404,8 @@ For example, consider a JSON file with a list of user info such as:
You can parameterize the users with the [`SharedArray`](https://grafana.com/docs/k6//javascript-api/k6-data/sharedarray) object as follows:
+
+
```javascript
import { check } from 'k6';
import http from 'k6/http';
@@ -422,14 +426,14 @@ export default function () {
});
const headers = { 'Content-Type': 'application/json' };
- const res = http.post('https://httpbin.test.k6.io/post', payload, {
+ const res = http.post('https://quickpizza.grafana.com/api/post', payload, {
headers,
});
check(res, {
'Post status is 200': (r) => res.status === 200,
'Post Content-Type header': (r) => res.headers['Content-Type'] === 'application/json',
- 'Post response name': (r) => res.status === 200 && res.json().json.name === user.username,
+ 'Post response name': (r) => res.status === 200 && res.json().name === user.username,
});
}
```
@@ -445,6 +449,8 @@ Though a test might be designed to induce failures, sometimes we focus on only t
The test script must handle API errors to avoid runtime exceptions and to ensure that it tests how the SUT behaves under saturation according to the test goals.
For example, we could extend our script to do some operation that depends on the result of the previous request:
+
+
```javascript
import { check } from 'k6';
import http from 'k6/http';
@@ -463,21 +469,21 @@ export default function () {
surname: user.surname,
});
const headers = { 'Content-Type': 'application/json' };
- const res = http.post('https://httpbin.test.k6.io/post', payload, {
+ const res = http.post('https://quickpizza.grafana.com/api/post', payload, {
headers,
});
check(res, {
'Post status is 200': (r) => res.status === 200,
'Post Content-Type header': (r) => res.headers['Content-Type'] === 'application/json',
- 'Post response name': (r) => res.status === 200 && res.json().json.name === user.username,
+ 'Post response name': (r) => res.status === 200 && res.json().name === user.username,
});
if (res.status === 200) {
// enters only successful responses
// otherwise, it triggers an exception
- const delPayload = JSON.stringify({ name: res.json().json.name });
- http.patch('https://httpbin.test.k6.io/patch', delPayload, { headers });
+ const delPayload = JSON.stringify({ name: res.json().name });
+ http.patch('https://quickpizza.grafana.com/api/patch', delPayload, { headers });
}
}
```
@@ -591,6 +597,8 @@ By default, k6 supports testing the following protocols:
- [Redis (experimental)](https://grafana.com/docs/k6//javascript-api/k6-experimental/redis/)
- [gRPC](https://grafana.com/docs/k6//javascript-api/k6-net-grpc/)
+
+
```javascript
import grpc from 'k6/net/grpc';
import { check, sleep } from 'k6';
diff --git a/docs/sources/k6/v0.56.x/using-k6/cookies.md b/docs/sources/k6/v0.56.x/using-k6/cookies.md
index 183a7cbcd2..8008c67f37 100644
--- a/docs/sources/k6/v0.56.x/using-k6/cookies.md
+++ b/docs/sources/k6/v0.56.x/using-k6/cookies.md
@@ -42,7 +42,7 @@ in subsequent requests to the server, include the cookie in the `cookies` reques
import http from 'k6/http';
export default function () {
- http.get('https://httpbin.test.k6.io/cookies', {
+ http.get('https://quickpizza.grafana.com/api/cookies', {
cookies: {
my_cookie: 'hello world',
},
@@ -64,8 +64,8 @@ import http from 'k6/http';
export default function () {
const jar = http.cookieJar();
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie', 'hello world');
- http.get('https://httpbin.test.k6.io/cookies');
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'my_cookie', 'hello world');
+ http.get('https://quickpizza.grafana.com/api/cookies');
}
```
@@ -84,7 +84,7 @@ import { check } from 'k6';
export default function () {
const jar = http.cookieJar();
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie', 'hello world');
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'my_cookie', 'hello world');
const cookies = {
my_cookie: {
@@ -93,7 +93,7 @@ export default function () {
},
};
- const res = http.get('https://httpbin.test.k6.io/cookies', {
+ const res = http.get('https://quickpizza.grafana.com/api/cookies', {
cookies,
});
@@ -116,7 +116,7 @@ import http from 'k6/http';
import { check } from 'k6';
export default function () {
- const res = http.get('https://httpbin.test.k6.io/cookies/set?my_cookie=hello%20world', {
+ const res = http.post('https://quickpizza.grafana.com/api/cookies?my_cookie=hello%20world', {
redirects: 0,
});
check(res, {
@@ -159,11 +159,11 @@ import http from 'k6/http';
import { check } from 'k6';
export default function () {
- const res = http.get('https://httpbin.test.k6.io/cookies/set?my_cookie=hello%20world', {
+ const res = http.post('https://quickpizza.grafana.com/api/cookies?my_cookie=hello%20world', {
redirects: 0,
});
const jar = http.cookieJar();
- const cookies = jar.cookiesForURL('https://httpbin.test.k6.io/');
+ const cookies = jar.cookiesForURL('https://quickpizza.grafana.com/api/cookies');
check(res, {
"has cookie 'my_cookie'": (r) => cookies.my_cookie.length > 0,
'cookie has correct value': (r) => cookies.my_cookie[0] === 'hello world',
@@ -191,17 +191,17 @@ import { check } from 'k6';
export default function () {
const jar = http.cookieJar();
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie', 'hello world', {
- domain: 'httpbin.test.k6.io',
- path: '/cookies',
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'my_cookie', 'hello world', {
+ domain: 'quickpizza.grafana.com',
+ path: '/api/cookies',
secure: true,
max_age: 600,
});
- const res = http.get('https://httpbin.test.k6.io/cookies');
+ const res = http.get('https://quickpizza.grafana.com/api/cookies');
+
check(res, {
'has status 200': (r) => r.status === 200,
- "has cookie 'my_cookie'": (r) => r.cookies.my_cookie[0] !== null,
- 'cookie has correct value': (r) => r.cookies.my_cookie[0].value == 'hello world',
+ 'cookie has correct value': (r) => r.json().cookies.my_cookie == 'hello world',
});
}
```
@@ -224,19 +224,18 @@ export default function () {
// Add cookie to local jar
const cookieOptions = {
- domain: 'httpbin.test.k6.io',
- path: '/cookies',
+ domain: 'quickpizza.grafana.com',
+ path: '/api/cookies',
secure: true,
max_age: 600,
};
- jar.set('https://httpbin.test.k6.io/cookies', 'my_cookie', 'hello world', cookieOptions);
+ jar.set('https://quickpizza.grafana.com/api/cookies', 'my_cookie', 'hello world', cookieOptions);
// Override per-VU jar with local jar for the following request
- const res = http.get('https://httpbin.test.k6.io/cookies', { jar });
+ const res = http.get('https://quickpizza.grafana.com/api/cookies', { jar });
check(res, {
'has status 200': (r) => r.status === 200,
- "has cookie 'my_cookie'": (r) => r.cookies.my_cookie[0] !== null,
- 'cookie has correct value': (r) => r.cookies.my_cookie[0].value == 'hello world',
+ 'cookie has correct value': (r) => r.json().cookies.my_cookie == 'hello world',
});
}
```
diff --git a/docs/sources/k6/v0.56.x/using-k6/metrics/create-custom-metrics.md b/docs/sources/k6/v0.56.x/using-k6/metrics/create-custom-metrics.md
index 56d2cc0200..10e707f32a 100644
--- a/docs/sources/k6/v0.56.x/using-k6/metrics/create-custom-metrics.md
+++ b/docs/sources/k6/v0.56.x/using-k6/metrics/create-custom-metrics.md
@@ -29,6 +29,7 @@ This limits memory and ensures that k6 can validate that all thresholds are eval
The generic procedure to create a custom metric is as follows:
1. Import the [`k6/metrics`](https://grafana.com/docs/k6//javascript-api/k6-metrics) module. Optionally, specify the type of metrics you want to create with a named import:
+
```javascript
import { Trend } from 'k6/metrics';
@@ -37,6 +38,8 @@ The generic procedure to create a custom metric is as follows:
1. In init context, construct a new custom-metric object.
For example, the following creates a custom trend. The object in the script is called `myTrend`, and its metric appears in the results output as `waiting_time`.
+
+
```javascript
const myTrend = new Trend('waiting_time');
@@ -57,7 +60,7 @@ import { Trend } from 'k6/metrics';
const myTrend = new Trend('waiting_time');
export default function () {
- const r = http.get('https://httpbin.test.k6.io');
+ const r = http.get('https://quickpizza.grafana.com/');
myTrend.add(r.timings.waiting);
console.log(myTrend.name); // waiting_time
}
diff --git a/docs/sources/k6/v0.56.x/using-k6/scenarios/concepts/graceful-stop.md b/docs/sources/k6/v0.56.x/using-k6/scenarios/concepts/graceful-stop.md
index b828ac9390..e2002fda61 100644
--- a/docs/sources/k6/v0.56.x/using-k6/scenarios/concepts/graceful-stop.md
+++ b/docs/sources/k6/v0.56.x/using-k6/scenarios/concepts/graceful-stop.md
@@ -40,7 +40,7 @@ export const options = {
export default function () {
const delay = Math.floor(Math.random() * 5) + 1;
- http.get(`https://httpbin.test.k6.io/delay/${delay}`);
+ http.get(`https://quickpizza.grafana.com/api/delay/${delay}`);
}
```
diff --git a/docs/sources/k6/v0.56.x/using-k6/scenarios/concepts/open-vs-closed.md b/docs/sources/k6/v0.56.x/using-k6/scenarios/concepts/open-vs-closed.md
index 1fc96de47a..ab8e7e7799 100644
--- a/docs/sources/k6/v0.56.x/using-k6/scenarios/concepts/open-vs-closed.md
+++ b/docs/sources/k6/v0.56.x/using-k6/scenarios/concepts/open-vs-closed.md
@@ -46,7 +46,7 @@ export default function () {
// and we can expect to get 10 iterations completed in total for the
// full 1m test duration.
- http.get('https://httpbin.test.k6.io/delay/6');
+ http.get('https://quickpizza.grafana.com/api/delay/6');
}
```
@@ -113,7 +113,7 @@ export default function () {
// new VU iterations will start at a rate of 1 every second,
// and we can thus expect to get 60 iterations completed
// for the full 1m test duration.
- http.get('https://httpbin.test.k6.io/delay/6');
+ http.get('https://quickpizza.grafana.com/api/delay/6');
}
```
diff --git a/docs/sources/k6/v0.56.x/using-k6/tags-and-groups.md b/docs/sources/k6/v0.56.x/using-k6/tags-and-groups.md
index 77f3d96c57..cc56e00329 100644
--- a/docs/sources/k6/v0.56.x/using-k6/tags-and-groups.md
+++ b/docs/sources/k6/v0.56.x/using-k6/tags-and-groups.md
@@ -83,7 +83,7 @@ const myTrend = new Trend('my_trend');
export default function () {
// Add tag to request metric data
- const res = http.get('https://httpbin.test.k6.io/', {
+ const res = http.get('https://quickpizza.grafana.com/', {
tags: {
my_tag: "I'm a tag",
},
@@ -109,6 +109,7 @@ You can set these tags in two ways:
- In the script itself:
{{< code >}}
+
```javascript
export const options = {
@@ -128,6 +129,8 @@ To support advanced tagging workflows, it is also possible to directly set and g
[k6/execution.vu.tags](https://grafana.com/docs/k6//javascript-api/k6-execution/#vu) object's properties can indeed be directly assigned new key/value pairs to define new tags dynamically. This can prove useful, as demonstrated in the following example, to track a container's group from nested groups, and aggregating nested group's sub-metrics.
+
+
```javascript
import http from 'k6/http';
import exec from 'k6/execution';
@@ -146,14 +149,14 @@ export default function () {
group('main', function () {
http.get('https://test.k6.io');
group('sub', function () {
- http.get('https://httpbin.test.k6.io/anything');
+ http.get('https://quickpizza.grafana.com/');
});
http.get('https://test-api.k6.io');
});
delete exec.vu.tags.containerGroup;
- http.get('https://httpbin.test.k6.io/delay/3');
+ http.get('https://quickpizza.grafana.com/api/delay/3');
}
```
@@ -175,6 +178,8 @@ Similar to other tags tag, the tag is added to all samples collected during the
One way to tag the executed operations is to invoke the `tagWithCurrentStageIndex` function for setting a `stage` tag for identifying the stage that has executed them:
+
+
```javascript
import http from 'k6/http';
import exec from 'k6/execution';
@@ -182,8 +187,8 @@ import { tagWithCurrentStageIndex } from 'https://jslib.k6.io/k6-utils/1.3.0/ind
export const options = {
stages: [
- { target: 5, duration: '5s' },
- { target: 10, duration: '10s' },
+ { target: 5, duration: '2s' },
+ { target: 10, duration: '5s' },
],
};
@@ -198,13 +203,15 @@ export default function () {
Additionally, a profiling function `tagWithCurrentStageProfile` can add a tag with a computed profile of the current running stage:
+
+
```javascript
import http from 'k6/http';
import exec from 'k6/execution';
import { tagWithCurrentStageProfile } from 'https://jslib.k6.io/k6-utils/1.3.0/index.js';
export const options = {
- stages: [{ target: 10, duration: '10s' }],
+ stages: [{ target: 2, duration: '5s' }],
};
export default function () {
@@ -238,7 +245,7 @@ The profile value based on the current stage can be one of the following options
"group ": "::my group::json ",
"method ": "GET ",
"status ": "200 ",
- "url ": "https://httpbin.test.k6.io/get "
+ "url ": "http://quickpizza.grafana.com"
}
},
"metric ": "http_req_duration "
@@ -319,16 +326,18 @@ import http from 'k6/http';
const id = 5;
-// reconsider this type of code
-group('get post', function () {
- http.get(`http://example.com/posts/${id}`);
-});
-group('list posts', function () {
- const res = http.get(`http://example.com/posts`);
- check(res, {
- 'is status 200': (r) => r.status === 200,
+export default function () {
+ // reconsider this type of code
+ group('get post', function () {
+ http.get(`http://example.com/posts/${id}`);
});
-});
+ group('list posts', function () {
+ const res = http.get(`http://example.com/posts`);
+ check(res, {
+ 'is status 200': (r) => r.status === 200,
+ });
+ });
+}
```
{{< /code >}}
diff --git a/docs/sources/k6/v0.56.x/using-k6/test-lifecycle.md b/docs/sources/k6/v0.56.x/using-k6/test-lifecycle.md
index 46f612691c..02f91ce4f3 100644
--- a/docs/sources/k6/v0.56.x/using-k6/test-lifecycle.md
+++ b/docs/sources/k6/v0.56.x/using-k6/test-lifecycle.md
@@ -76,6 +76,8 @@ Code in the `init` context _always executes first_.
{{< code >}}
+
+
```javascript
// init context: importing modules
import http from 'k6/http';
@@ -152,7 +154,7 @@ For example, you can make HTTP requests:
import http from 'k6/http';
export function setup() {
- const res = http.get('https://httpbin.test.k6.io/get');
+ const res = http.get('https://quickpizza.grafana.com/api/json');
return { data: res.json() };
}
@@ -258,6 +260,7 @@ k6 has a few additional ways to use lifecycle functions:
- **Scenario functions**. Instead of the `default` function, you can also run VU code in scenario functions.
{{< code >}}
+
```javascript
import http from 'k6/http';
diff --git a/docs/sources/k6/v0.56.x/using-k6/thresholds.md b/docs/sources/k6/v0.56.x/using-k6/thresholds.md
index 9093546701..634f702bda 100644
--- a/docs/sources/k6/v0.56.x/using-k6/thresholds.md
+++ b/docs/sources/k6/v0.56.x/using-k6/thresholds.md
@@ -35,6 +35,8 @@ The other evaluates whether 95 percent of responses happen within a certain dura
{{< code >}}
+
+
```javascript
import http from 'k6/http';
@@ -79,6 +81,7 @@ and k6 would exit with a non-zero exit code.
To use a threshold, follow these steps:
1. In the `thresholds` property of the `options` object, set a key using the name of the metric you want the threshold for:
+
```javascript
export const options = {
@@ -92,6 +95,7 @@ To use a threshold, follow these steps:
- The short format puts all threshold expressions as strings in an array.
- The long format puts each threshold in an object, with extra properties to [abort on failure](#abort-a-test-when-a-threshold-is-crossed).
+
```javascript
export const options = {
@@ -148,26 +152,28 @@ setting different types of thresholds for each:
{{< code >}}
+
+
```javascript
import http from 'k6/http';
import { Trend, Rate, Counter, Gauge } from 'k6/metrics';
import { sleep } from 'k6';
export const TrendRTT = new Trend('RTT');
-export const RateContentOK = new Rate('Content OK');
+export const RateContentOK = new Rate('ContentOK');
export const GaugeContentSize = new Gauge('ContentSize');
export const CounterErrors = new Counter('Errors');
export const options = {
thresholds: {
// Count: Incorrect content cannot be returned more than 99 times.
- 'Errors': ['count<100'],
+ Errors: ['count<100'],
// Gauge: returned content must be smaller than 4000 bytes
- 'ContentSize': ['value<4000'],
+ ContentSize: ['value<4000'],
// Rate: content must be OK more than 95 times
- 'Content OK': ['rate>0.95'],
+ ContentOK: ['rate>0.95'],
// Trend: Percentiles, averages, medians, and minimums
// must be within specified milliseconds.
- 'RTT': ['p(99)<300', 'p(70)<250', 'avg<200', 'med<150', 'min<100'],
+ RTT: ['p(99)<300', 'p(70)<250', 'avg<200', 'med<150', 'min<100'],
},
};
@@ -196,6 +202,8 @@ Since thresholds are defined as the properties of a JavaScript object, you can't
{{< code >}}
+
+
```javascript
export const options = {
thresholds: {
@@ -298,6 +306,8 @@ For each group, there are different thresholds.
{{< code >}}
+
+
```javascript
import http from 'k6/http';
import { group, sleep } from 'k6';
@@ -337,6 +347,8 @@ export default function () {
It's often useful to specify thresholds on a single URL or specific tag.
In k6, tagged requests create sub-metrics that you can use in thresholds:
+
+
```javascript
export const options = {
thresholds: {
@@ -349,6 +361,8 @@ And here's a full example.
{{< code >}}
+
+
```javascript
import http from 'k6/http';
import { sleep } from 'k6';
@@ -398,6 +412,8 @@ After ten seconds, the test aborts if it fails the `p(99) < 10` threshold.
{{< code >}}
+
+
```javascript
export const options = {
thresholds: {
@@ -427,6 +443,8 @@ Here is an example:
{{< code >}}
+
+
```javascript
import http from 'k6/http';
@@ -476,7 +494,7 @@ export const options = {
};
export default function () {
- const res = http.get('https://httpbin.test.k6.io');
+ const res = http.get('https://quickpizza.grafana.com/api/status/500');
check(res, {
'status is 500': (r) => r.status == 500,
@@ -509,12 +527,12 @@ export const options = {
export default function () {
let res;
- res = http.get('https://httpbin.test.k6.io');
+ res = http.get('https://quickpizza.grafana.com/api/status/500');
check(res, {
'status is 500': (r) => r.status == 500,
});
- res = http.get('https://httpbin.test.k6.io');
+ res = http.get('https://quickpizza.grafana.com/api/status/200');
check(
res,
{
diff --git a/docs/sources/k6/v0.56.x/using-k6/workaround-iteration-duration.md b/docs/sources/k6/v0.56.x/using-k6/workaround-iteration-duration.md
index afcdec629f..408c161d1c 100644
--- a/docs/sources/k6/v0.56.x/using-k6/workaround-iteration-duration.md
+++ b/docs/sources/k6/v0.56.x/using-k6/workaround-iteration-duration.md
@@ -35,7 +35,7 @@ export const options = {
};
export function setup() {
- http.get('https://httpbin.test.k6.io/delay/5');
+ http.get('https://quickpizza.grafana.com/api/delay/5');
}
export default function () {
@@ -44,7 +44,7 @@ export default function () {
}
export function teardown() {
- http.get('https://httpbin.test.k6.io/delay/3');
+ http.get('https://quickpizza.grafana.com/api/delay/3');
sleep(5);
}
```