How does Postman generate the Cookie for the request to work?

This isn’t really an Elixir question, moreso a general Postman question.

I’m using Postman to HTTP GET this URL:

The request works and it returns the JSON I’m expecting. When I use the “copy as curl” feature, the request works in my Terminal.

curl --location ‘
–header ‘Cookie: mitata=ZDY4NmU2NDA3NjFlNGE2YjQ0YjAxY2NkMzY1OTU3MmRiNDFiOTAyY2UzOTRmMmQ3NTBlZDZlNDE3M2IxZTY2ZA== /@#/1701625898_/@#/cttujxbBJYtyKSbd_/@#/NGZhODVhZmNjY2UyZmJhOWE3MTk1MzQ0NWI5NmQwNDk4YTBhZTY2MWI0YjI1ZjQ5YzFhNmEwMjVhOWZmYzNlOA==_/@#/000’

After a few minutes the CURL request breaks, and I have to use Postman to make the GET request again because I noticed that the Cookie value is being changed automatically by Postman.

My question is how is Postman automatically refreshing this cookie value and how can I do this myself in Elixir code?

Is it doing some kind of preflight hit to the URL?


By doing curl -c mycookies.txt yada yada I’m able to save the cookie value and then use it to make the original request work.

Now to automate this…

Have you checked the Set-Cookie header in the response? This is the mechanism used to store cookies in the browser.

1 Like

Turns out Req does this automatically for me, so I was worrying ahead of time over this for nothing. :laughing:

Thanks @wojtekmach !