- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to Add Cookies in Postman?
We can add cookies in Postman. To add a cookie, the below steps need to be followed −
Step1 − Navigate to the Params tab below the address bar and then click on Cookies.
Step2 − The MANAGE COOKIES window shall open. It lists down all the current cookies. To add a cookie, click on the Add Cookie button. An edit box with pre-populated values of the cookie are displayed. We can update the value and Save it.
Step3 − Send the request to the server.
Step4 − After the request has been successfully completed, the Cookies tab in the Response will show the newly added cookie – Cookie_Postman.
We can also add a cookie programmatically and not from the GUI. For that, we have to first create a Cookie jar object with the help of the pm.cookies.jar method.
const cnt = pm.cookies.jar()
Then to create a cookie we have to use the function - .set. This function takes the URL, cookie name and value as parameters.
const cnt = pm.cookies.jar(); cnt.set(URL, cookie name, cookie value, callback(error, cookie))
- Related Articles
- How to Manage Cookies in Postman?
- Executing Tests on Cookies in Postman
- How to create cookies in JavaScript?
- How to delete cookies in JavaScript?
- How to set cookies in ReactJS?
- How to manage cookies in WebdriverIO?
- How to Import Collection in Postman?
- How to Monitor Collections in Postman?
- How to use Sessions in Postman?
- How to create sessions in Postman?
- How to parameterize requests in Postman?
- How to set named cookies in JavaScript?
- How to set multiple cookies in JavaScript?
- How to Generate API Documentation in Postman?
- How to use dynamic GUID in Postman?
