How to check if response header is missing

pm.response.not.to.have.header(“MyHeaderHere”) not working.

Hey @nidhi27gupta,

I think you just have the chained getters the wrong way round. This should be what you’re after:

pm.test("Response doesn't have header", function () {
    pm.response.to.not.have.header("MyHeaderHere");
});
2 Likes