I am trying to use chained request to mimic the flow of logging in to our application and then formulating a POST command. In the response header of my login request, there is Set-Cookie that sets two cookies named _csrf and connect.sid. I need to use both of these cookies for my subsequent chained POST request, however I only seem to have visibility to the _csrf cookie.
If I use
postman.getResponseHeader("Set-Cookie"))
the result is something like
{_csrf: "Gs2Bdmb_Yy7om3zkdON2-Erf"}
Yet when I perform the same request in my browser, I see both cookies.
I wasn’t sure that I needed to implement a cookie jar since I am only trying to harvest the cookie values from a Response to use in subsequent Requests. I am not creating any new cookies. I thought, maybe incorrectly, that using pm.getResponseHeader to store the values in variables or just having Postman natively use the cookies would be adequate. In both cases, only the _csrf cookie is available in the getResponseHeader method and in the “Cookies” section of the response in the Postman UI after my login request. Also, I don’t actually see the “Set-Cookie” property in the Postman UI or Postman console in the Response, but the pm.getResponseHeader(“Set-Cookie”) returns the results I mentioned in my original post.
When I perform the same request in my browser and view the Response header, I see the Set-Cookie property with both cookies in it. When I view the cookies in browser console, both of the cookies are there.