Skip to content

How to log response status log in postman

How do I console the response status code in Postman ?

I have this snippet here:

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

I want to log response status code 200 if I get it.

Thank you in advance

Answer

console.log(pm.response.code)

you can get it from pm.response object in test script section