@@ -7,40 +7,17 @@ draft: 'false'
7
7
<CodeGroup labels={[ "single-request.js"] } lineNumbers={[ true] }>
8
8
9
9
``` javascript
10
- import http from ' k6/http' ;
11
- import { sleep , check } from ' k6' ;
12
- import { Counter } from ' k6/metrics' ;
13
10
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" ;
20
12
21
13
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 ,
30
15
};
31
16
32
17
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/" );
43
19
}
44
20
```
45
21
46
22
</CodeGroup >
23
+
0 commit comments