Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I find response cookie names in Postman tests?

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.

like image 487
fil Avatar asked Dec 07 '25 15:12

fil


2 Answers

Got it! I evaluated responseCookies to determine the cookie name.

like image 174
fil Avatar answered Dec 09 '25 04:12

fil


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.

like image 31
Brian De Sousa Avatar answered Dec 09 '25 03:12

Brian De Sousa



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!