rjz / supertest-session

Persistent sessions for supertest
Other
88 stars 21 forks source link

Document how to make supertest use the CookieAccessInfo #27

Closed ctavan closed 5 years ago

ctavan commented 7 years ago

Manually configuring the cookieAccess setting does not yet have any effect on the behavior of the underlying supertest agent since the agent has a CookieAccessInfo policy hardcoded, derived from the url: https://github.com/visionmedia/superagent/blob/7bc01ecc30ca5fc4fcb493887334e650d901c5a3/lib/node/agent.js#L57

However there's an easy workaround to make use of the manually configured cookieAccess config by setting the cookies in the before hook which I have documented in this patch.

rjz commented 7 years ago

Thanks, @ctavan! This seems like it might have been a "fun" one to diagnose and track down.

Happy to merge this up if we can think of cases where we wouldn't want to apply the same options consistently throughout, but it also seems reasonable to expect that the cookieAccess params will be used if the user provides them. Maybe we should adjust the code to override by default?