Https get returning a null body

Hi all,

making a https get call and it reporting a null body as a response :frowning:
Code:

const Url = new URL(systemUrlPort + '/v1/content-hub-service/mobile/sports/nextToGo');
Url.searchParams.append('jurisdiction', state);
 console.log("Url: " +  Url.toString());
// call the url with parameters
const resp = http.get(Url.toString());
// add response times to custom transaction.
const respCheck = check(resp, {
    'status is 200': (r) => r.status === 200,                     
    'response body': (r) => r.body.indexOf('nextToGo') !== -1,   
  });
  return SportsNextToGo;

error I am getting:

ERRO[0010] TypeError: Cannot read property 'indexOf' of undefined or null

When I run the script with --http-debug=full it returns a correct header and response body.

When I copy the URL into a browser it works fine as well.

Any ideas as to where I’m going wrong?

sorted, my bad :slight_smile:

had discardResponseBodies: true, set,

removed it and works fine :slight_smile:

2 Likes

Hey @BobRuub

Glad you sorted it out :+1:

This was driving me crazy for a couple hours. I’m happy I found this post so I could remove the discardResponseBodies I had also set to True