Does K6 read entire response body or just the headers?

Hi!

We are testing an endpoint that produces a pretty large response (almost a MB of json). So I was wondering: does K6 actually read the body and if so, is that time included in the request duration? Or does it only wait until the headers are received and then move on to the next iteration?

Hi @johnknoop,
welcome to the community forum :tada:

I think what you’re looking for is the discard response bodies option.

k6 reads the entire response, the header and the body, instead setting the mentioned option then k6 excludes the body. It’s commonly used when a heavy body is returned.

The documentation contains a dedicated section about the builtin HTTP metrics explaining what they include.

Let me know if it helps.

So it reads the entire body by default? That’s good, that’s what we were hoping, because any real consumer of our API will of course have to do that as well, so this way the performance test becomes more realistic.

Thanks!