Status test | TypeError: Cannot read property 'to' of undefined

Hello!
In the description of the link

this example script is specified:

pm.test("Status test", function () {
    pm.response.to.have.status(200);
});

But when running this script in Postman, an error occurs:

Status test | TypeError: Cannot read property ‘to’ of undefined

Tell me, is this an incorrect description or an error in Postman?

I’ve been using that test so much today so. I hope it’s not that :grin:

Do you have any other scripts in place in the Collection? Have you placed that in the Pre-request Script or Tests?

Can you show an image on the script and the error, please.

Oh my God, I’m an idiot)) I put this script in the Pre-request Script and clack-clack-clack! :smile: I haven’t used Postman for a long time. Thank you very much for the hint!!

1 Like

Then I’m an idiot too…I’ve done that far too many times and was left scratching my head :grin:

Glad it’s all sorted!! :trophy: