Skip to content

Commit 9b3bf14

Browse files
[fix] correct example of a single request
Thanks to discussion in the community slack for calling this out.
1 parent 7943760 commit 9b3bf14

File tree

1 file changed

+4
-27
lines changed

1 file changed

+4
-27
lines changed

src/data/markdown/docs/05 Examples/01 Examples/01 single-request.md

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,40 +7,17 @@ draft: 'false'
77
<CodeGroup labels={["single-request.js"]} lineNumbers={[true]}>
88

99
```javascript
10-
import http from 'k6/http';
11-
import { sleep, check } from 'k6';
12-
import { Counter } from 'k6/metrics';
1310

14-
// A simple counter for http requests
15-
16-
export const requests = new Counter('http_reqs');
17-
18-
// you can specify stages of your test (ramp up/down patterns) through the options object
19-
// target is the number of VUs you are aiming for
11+
import http from "k6/http";
2012

2113
export const options = {
22-
stages: [
23-
{ target: 20, duration: '1m' },
24-
{ target: 15, duration: '1m' },
25-
{ target: 0, duration: '1m' },
26-
],
27-
thresholds: {
28-
http_reqs: ['count < 100'],
29-
},
14+
iterations: 1,
3015
};
3116

3217
export default function () {
33-
// our HTTP request, note that we are saving the response to res, which can be accessed later
34-
35-
const res = http.get('http://test.k6.io');
36-
37-
sleep(1);
38-
39-
const checkRes = check(res, {
40-
'status is 200': (r) => r.status === 200,
41-
'response body': (r) => r.body.indexOf('Feel free to browse') !== -1,
42-
});
18+
const response = http.get("https://test-api.k6.io/public/crocodiles/");
4319
}
4420
```
4521

4622
</CodeGroup>
23+

0 commit comments

Comments
 (0)