Getting request body as null

Hi,
I’m getting an error " TypeError: Cannot read property ‘includes’ of undefined or null "
when I include check r.body.includes(“success”) for a small no of requests the check is working fine but when the load increases I’m getting the response body as null.
I don’t know if the request is failed or not, it seems I’m getting this response for 90% of the request

Hi @ializrocks !

I’m getting an error " TypeError: Cannot read property ‘includes’ of undefined or null "
when I include check r.body.includes(“success”) for a small no of requests the check is working fine but when the load increases I’m getting the response body as null.

Which is expected :slight_smile:

What you describe is the result of the load test. You got the state when your server doesn’t respond appropriately (it returns an empty body). So my recommendation is before you check if a body contains “success,” do some general check, like HTTP status, or maybe check if the body is presented.

check(res, {
      "status is 200": (r) => r.status === 200,
      "response body contains succsess": (r) => r.body.includes(“success”)
  });

But regardless of the order of the checks, empty response from the server is a clear indication that you have to tune your server.

Let me know if that helps,
Cheers!