haskell / haskell/wreq

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

未关闭
#145 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Haskell
星标
381
派生
72
PR 合并指标
30 天内没有已合并 PR

描述

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.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。