Skip to content
This repository was archived by the owner on Nov 4, 2019. It is now read-only.

Interceptor multiplies & mixes cookies #41

Open
moeskerv opened this issue Oct 15, 2015 · 2 comments
Open

Interceptor multiplies & mixes cookies #41

moeskerv opened this issue Oct 15, 2015 · 2 comments
Labels

Comments

@moeskerv
Copy link

Postman, Interceptor and Jetpacks is used to test a REST API.

I use the Cookie header in Postman request to send a cookie together with the request.
The value field for the cookie is filled with environment variables from Postman like this

User 1

Header Value
Content-Type application/json
Authorization Basic {{auth}}
Cookie GSESS={{cookie}}_{{id}}

This works fine for a while, the cookie is sent:

image

But after some calls interceptor starts to send multiple identical cookies.

image

When different users are involved with different cookie content it also happens that cookies gets mixed:

User 2

Header Value
Content-Type application/json
Authorization Basic {{auth2}}
Cookie GSESS={{cookie2}}_{{id2}}

image

As a workaround deleting the browser cookies helps for the next few requests.
Unfortunately this issue is easy and often reproduced in my scenario.
My collections work fine with newman.

@moeskerv
Copy link
Author

Some more background which may help:

Sending multiple cookies:

IMHO this seems to be an Chrome issue, I can see that in the setCookiesFromHeader the interceptor sets the correct cookie and it sets it once only as expected. In my tests I'm using quite long URLs (long path), this seems to be the background, chrome seems to mix them for some reason. When reduce the url by excluding the path in the setCookiesFromHeader no double cookies are sent any more.

Mixing cookies, or sending wrong cookie

This seems to be caused by the async. nature of the chrome.cookies.set function used in setCookiesFromHeader. Due to interceptor does not wait for the callback it seems to happens that the correct cookie sometimes isn't yet set when the XHR call is made.
Observation: When stepping through the code the issue does not occur. When adding a dirty wait in the code after chrome.cookies.set the issue does not occur.

@abhijitkane
Copy link
Member

@moeskerv Thanks for reporting this. We'll investigate and get back to you soon.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants