-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Working with cookies (question) #81
Comments
I am unsure what you are asking. Req allows you to use a specific
It hurts my heart to discover that Haskell sucks so badly even at simplest tasks. I do not understand why people use it for anything, honestly. |
Default route is obvious.
I understand that the main point of your library was completely different. But now it's in the wild and faced people with almost zero Haskell knowledge. |
I wish to use cookies across requests. I am aware that a CookieJar can be obtained from a response. But to merge cookies across requests, I need |
To give a real world example: I was confronted by the need to emulate a browser state, and I ended up threading an MVar through, like this:
I wrapped all the methods I need like this. It works fine. I am not sure if this package needs to incorporate this feature, but it seems to be a common use case and rolling out the wrappers takes some typing. @mrkkrp you are in the best position to judge if the code to this end should be admitted to the library, but surely at least some examples and directions may be given. |
@kindaro: Thanks. Yes, I am able to reuse the cookies returned in one response for the following request. The above is sufficient If all responses contained 'set-cookie' values for the same set of cookies. But if different responses update subsets of the cookie-jar, then cookies need to be accumulated across requests. In the case, one would need to use |
Oh I see, so you have some requests that do not send back a cookie jar. At first I did not realize that. It looks like some sort of a monad here, a hybrid between Writer and State. |
Am I correct that we could solve (or at least alleviate) the issue by adding a new method to the |
I think you can extract the |
How can I add custom names to cookies?
L.cookie_name
and all other constructors fromhttps://hackage.haskell.org/package/http-client-0.5.1/docs/Network-HTTP-Client.html
data Cookie
are OK, but my original cookie hasTruly speaking, everything works with HTTP-Client cookies only, but, as we are in Haskell domain, "it's not pure enough" (pun intended).
Mark, thanks a lot for your library, it's my second attempt to use it as a test site for my humble Haskell skills. But not everything is terrible with them only. It took maybe 5 hours of tinkering to create a working snippet of simple task "log into cite having cookies from FF". In any other language (even F#) I could do this from scratch (with zero previous knowledge) maybe for 20 minutes just copy-pasting from Stackoverflow.
I might be searching in wrong places, but it seems there is no single example of using cookies. Now I have one of my own, if you are still interested in this project, I may give it to you, you may add it to docs (after honing my terrible childish Haskell style).
The text was updated successfully, but these errors were encountered: