How to ignore upper or lower case in a pm.response


the email address in the env variable will be added either with caps or no caps, is there a way I can force the pm.expect to ignore upper or lower case?

Hi @thingmie

Try this;

let text = "HeLlO WoRlD!";
let result = text.toLowerCase();


Or more specifically for what you would need;

Many thanks @w4dd325, although I get an error :innocent:

response.emailAddress is my example… you would need to change this to the nested structure of your JSON…

Looking at your original post your JSON would be;

But I wouldn’t be able to confirm this unless your shared your response body.

lowercase email address passes

but if the email_address env var = it fails.

It would fail as you have only instructed the code to change the response value to lower case, not your environment variable.

if you want both to be set as lower case you would have to change your assertion to;


You are an absolute star @w4dd325 that’s worked out perfectly. top-man, have a great day.

Lastly, Is this structure ok? @w4dd325 I need to verify 3 properties in 1 test.

Looks ok to me.
Does it pass?

yeah, but I’m not sure how to mock the _id and email_verified values to prove it.

What do you mean by “mock the _id and email_verified values”?
These are in your response, right?
If you want to see the values of those properties then just console log it.

I wondered if i could change the values during runtime so i can test the logic; and yes they’re in the response.