Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Use of request's global cookie `jar` #73
Sorry to keep firing issues at you - don't worry, I'll do a pull request for this if you agree its a problem. :)
request uses a global cookie jar, into which all response cookies are stored, and then used on subsequent requests. This behaviour is enabled by default; you have to set
I believe that nano should always default for
Because of the nature of nano and CouchDB, it is likely that you will doing multiple nano requests as different users (especially if you have a 1 user to 1 database set up) within a single method.
This probably hasn't been noticed before as nano hasn't had support for CouchDB's cookie authentication. But with this coming (#71), it is especially problematic having
See this gist for an example: https://gist.github.com/2717116
It should just be a case of changing this code from:
The interim workaround is to do the above, by using
I believe the problem is that nano doesn't (perhaps can't) instantiate request. This means that they all reference back to the same place (and therefore the same cookie jar). Try this out for example:
This comment has been minimized.
This comment has been minimized.Show comment Hide comment
my 2 cents: I know that by default request uses the same cookie jar for all requests.
FYI, you can construct a cookie jar in request by calling:
and you can associate it to a request like this:
if you don't want to use the cookie jar at all just pass
I agree that this needs to be an option, however I personally believe that the default should be
Its also confusing because whilst you can create separate instances of nano (and use them in isolation), the underlying request is a reference, not an instance - leading to potential confusion in the area of a jar. IMO