Comparing responseBody() to String not working properly

Hello,

I have a code that gets the body of a website. Depending on the GET request the arduino sends, the webpage will display true or false.
The following code isn't working properly:

if (client.responseBody() == "true") {
Serial.println("access granted");
} else {
 Serial.println("access denied");
}

If I try this, the if statement is always false and will print 'access denied' although if I do the following:

Serial.println(responseBody());

it displays true.

So the code should be printing 'access granted' when the response is true, but it doesn't.

So the code should be printing 'access granted' when the response is true, but it doesn't.

Check for invisible characters (spaces, newlines, carriage returns, etc.).