wreq icon indicating copy to clipboard operation
wreq copied to clipboard

Cookies that are set on Options are disregarded by the Session API

Open AlexeyRaga opened this issue 4 years ago • 0 comments

Cookies that set on Options are discarded by the session API when the session cookie jar is Just.

For example, request that is made using opts and sess from the following example will not contain myCookie.

let opts = defaults & cookies .~ (Just $ createCookieJar [myCookie])
sess <- Sess.newSessionControl (Just $ createCookieJar []) tlsManagerSettings

As far as I can see from the source code here session cookies always overwrite option ones, so the cookie from Options is disregarded by the session API. This happens after the request is "prepared" and already has cookies from Options. So cookies from Options get overwritten entirely by cookies from session.

Expected behaviour: cookies from both options and session are propagated to the request, just as headers do.

Reasoning: It should be possible to set cookies during the session (and not only at the time of starting a new session). Options is the only place where it can be done now, since Session itself doesn't provide any functionality for adding/removing cookies.

AlexeyRaga avatar Jul 31 '21 13:07 AlexeyRaga