Search code examples
haskellhttp-conduit

retrieving the values from responseCookieJar


Here is how I am sending a get request:

import Network.HTTP.Conduit
import Control.Applicative ((<$>))
import Network.HTTP.Types

request <- parseUrl $ "someUrl"
res <- withManager $ httpLbs request
putStrLn $ show $ responseCookieJar res

Instead of printing responseCookieJar I want to get a value from it. This http://hackage.haskell.org/package/http-conduit-2.1.2/docs/Network-HTTP-Conduit.html#t:CookieJar implies that it's not possible. So I figure I have to parse (by regexp) it as a string. But there must a standard way like getting a value by its key.

Isn't there?


Solution

  • You can call destroyCookieJar to break it into the individual Cookies, and then search that list.