I would like to know: how can I get the body data in response to each request in K6?

I tried using console.log(response.body), but it did not provide a solution for it. Either it gives a response in binary or displays nothing.

2 Answers 2


You can just use your the object from your request.

For example

let res = http.post(url, payload,params);

I've found that with some json, nulls have caused issues. In those cases I've used stringify to clean it up before printing.

 console.log(JSON.stringify(res, null, "  "));

It works for me

const res = http.get(`${url}/v1/`)
check(res, {
  'is status 200': (r) => r.status === 200

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.