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


It works for me

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

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, "  "));

Your Answer

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

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