import { Request, Client, checkstatus } from "k6/x/fasthttp";
export const options = {
vus: 1,
iterations: 3
};
const client = new Client({
max_conns_per_host: 1,
tls_config: {
insecure_skip_verify: true
}
})
export default function () {
let req = new Request('https://test-api.k6.io/public/crocodiles/', {
headers: {
"content-type": "application/json"
}
});
let res = client.get(req);
console.log(res.status);
checkstatus(200, res);
}
Below is the output when I run it. While the output for console.log(res.status); indicates that all requests returned 200 OK, the check using checkstatus(200, res) failed. See screenshot from of its output:
Hey! 👋 I was following example usage of
checkstatus
from https://github.com/domsolutions/xk6-fasthttp/blob/master/examples/json.js#L11 but it doesn't work for me correctly.When I run following k6 script:
Below is the output when I run it. While the output for
console.log(res.status);
indicates that all requests returned 200 OK, the check usingcheckstatus(200, res)
failed. See screenshot from of its output:k6 version that I am using: