Cookies that are set on Options are disregarded by the Session API
- Dominant language
- Haskell
- Stars
- 381
- Forks
- 72
- PR merge metrics
- No merged PRs in 30d
Description
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`.
```haskell
let opts = defaults & cookies .~ (Just $ createCookieJar [myCookie])
sess <- Sess.newSessionControl (Just $ createCookieJar []) tlsManagerSettings
```
As far as I can see from the source code [here](https://github.com/haskell/wreq/blob/master/Network/Wreq/Session.hs#L268) 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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.