Using the Interceptor to read and write cookies

With the new version of Postman (1.0.2), and the Postman Interceptor (0.2.7), it is now possible to read and write cookies!

With the interceptor on, you can retrieve cookies set on a particular domain (Jetpacks only), and include cookies while sending requests.

Retrieving cookies:

1. Make sure the interceptor is enabled in Postman – Check that the traffic light icon in the top-right corner is green.

Interceptor icon
Interceptor icon

2. In the tests section (Jetpacks must be enabled for this), you can use the "responseCookies" object. This will return an array of cookie objects. To retrieve a particular name, use "postman.getResponseCookie(cookieName)". This will return a single cookie object. Each cookie object will contain the following properties:

domain, hostOnly, httpOnly, name, path, secure, session, storeId, value

Setting Cookies

1. Make sure the interceptor is enabled.

2. Include the "Cookie" header in the headers section

eg. Cookie: name=value; name2=value2

3. Send the request. The cookies you set will be sent by Chrome along with your request.

Set Cookie
Set Cookie