Is there a way to retrieve the response cookie names in a Postman test? I can get values with postman.getResponseCookie("<COOKIENAME>").value. However, based on differing scenarios, the cookiename changes.
Got it! I evaluated responseCookies to determine the cookie name.
You can check for a specific cookie in a test like this:
pm.test("Response contains a JSESSIONID cookie", function() {
pm.expect(pm.response.cookies.has('JSESSIONID')).to.be.true;
});
This works for me in Postman v7.3.6 without the Postman interceptor turned on.
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