Hi @ializrocks !
There is no value error
for the --http-debug
. It’s either --http-debug
or --http-debug="full"
. These options are for HTTP debugging.
For your needs can work something from below:
import { sleep, check } from 'k6';
import http from 'k6/http';
export default function () {
let resp = http.get("https://httpbin.test.k6.io/status/400/");
let passed = check(resp, {
"status is 200": (r) => r.status === 200,
"content is present": (r) => r.body.indexOf("whatever") !== -1,
});
if (!passed) {
console.log(`Request to ${resp.request.url} with status ${resp.status} failed the checks!`, JSON.stringify(resp));
}
sleep(1);
}
And run with:
k6 run --log-format json --log-output=file=./k6.log test.js
Regarding a --log-format
it’s pretty simple. It controls the format of the logs’ output. It’s either raw (print only the log message) or JSON (print all the debug information in JSON format).
Let me know if that helps,
Cheers!