Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending cookies with postman

I read the manual of sending request with cookie with postman:

As the packaged app runs in a sandbox separately from the browser, it can not access cookies set inside the browser. This restriction can also be overcome using the Interceptor extension. Postman routes all requests through the Interceptor, which then uses the browser context to send requests. Cookies set inside the browser are automatically attached to your requests. Read the original blog post on Interceptor.

Once the interceptor is enabled, you can also send cookies from Postman. Just set the "Cookie" header, and the cookie will be sent with the request. You can also get access to cookies that are available when the response is returned. Check out out blog post for more

So I downloaded the interceptor for google chrome, and it enable.

Also, I add the following to postman: Cookie JSESSIONID=daczcz36789

When I look at the network I notice that the Cookie is not sent.

What I do wrong?

like image 535
MIDE11 Avatar asked Jun 17 '15 11:06

MIDE11


People also ask

How do I manually add cookies to my Postman?

Go to the google.com domain in the manager and click Add Cookie. A new text box will open up where it will have some values already written. Change those values as given in the image below. Now you have added a new cookie to the domain google.com.

How do I send cookies in a post request?

To send cookies to the server, you need to add the "Cookie: name=value" header to your request. To send multiple Cookies in one cookie header, you can separate them with semicolons. In this Send Cookies example, we are sending HTTP cookies to the ReqBin echo URL.

How do I get cookies to respond to the Postman?

The cookies are mentioned under the Headers and Cookies tab in the Response in Postman. To work with Cookies, we have to click on the Cookies link available under the Params tab. On clicking on it, the MANAGE COOKIES appears. It contains all the available cookies along with the options – Add Cookie and Delete.

How would you use Postman Chrome app to read and write cookies?

Go to the Via Interceptor tab of the Capture requests window. Select Capture Cookies if you want to capture cookies in addition to requests during the debug session. You can use these cookies in your Postman requests. You can also capture cookies and sync them to Postman without starting a debug session.


2 Answers

I used the postman chrome extension until it became deprecated. Chrome extension is also less usable and powerful than the native postman application. Hence it became very inconvenient to use the chrome extension.

I have found another approach:

  1. copy any request in chrome/any other browser as a CURL request copy curl request
  2. import to postman copied request import to postman copied request
  3. save imported request in the postman's list
like image 153
Vaha Avatar answered Oct 03 '22 05:10

Vaha


You can enable Interceptor in browser and in Postman separately. For send/recieve cookies you should enable Interceptor in Postman. So if you enable interceptor only in browser - it will not work. Actually you don't need enable Interceptor in browser at all - if you don't want to flood your postman history with unnecessary requests.

like image 21
xxldoctor Avatar answered Oct 03 '22 04:10

xxldoctor