Cookies in Postman
Cookies are the files with very small size, which contain the information for server files or website pages. When you firstly open the website, a cookie file will be downloaded to your machine. This cookie contains some details; the same site can use the details when you visit again. This allows the website to offer a detailed response according to your last visit.
In postman, we can see the cookies that were sent as a response from the server. We cannot make any changes to the cookies since we got from the server.
To start the work on cookies in postman, open the Cookies option from the right side of the postman window under the Send button.
When you select cookies, then it will open the Manage Cookies window. Here you can see the domains list and cookies linked with them.
Create a Cookie
In postman, we can also create new cookies for the domain. To create a new cookie, select the 'Add Cookie' button.
Here, I will take the www.google.com domain.
Enter the domain name in the URL text field and click on the Add button.
Since we already have a google.com domain in the inventory, we will directly add the cookies. Click on '+Add Cookie.'
A new text box will open where some default values are already written. Edit those values as given below example:
Click on the Save button.
Here you can see your newly created cookie.
Close the panel. And enter the URL www.google.com in the URL text field and click on send. Go to the Response section and click on the Cookies tab. We can see the cookie which we have added here.
Updating a Cookie
In postman, we can update the cookies. Click on 'Cookies' to change an existing cookie and pick the domain from the domain list in the MANAGE COOKIES section, then click the cookie you want to update. We can change any property, and click Save to update.
Deleting a Cookie
Deleting a cookie is very easy. To delete an existing cookie, click on 'Cookies,' and in the MANAGE COOKIES section, select the domain from the domain list, go to the cookie you want to delete, and click on X option. Your cookie will be deleted.