I would like to check the value from a concrete response header ("Location") as Test Results in Postman. In the Postman's documentation I found examples of how to check the existance of headers with
pm.test("Content-Type is present", function () { pm.response.to.have.header("Content-Type"); });
But what I'm looking for is something like
pm.test("Location value is correct", function () { CODE HERE THAT CHECKS "Location" HEADER EQUALS TO SOMETHING; });
I finally found the solution:
pm.test("Redirect location is correct", function () { pm.response.to.have.header("Location"); pm.response.to.be.header("Location", "http://example.com/expected-redirect-url"); });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With