Reputation: 3434
I want to make HTTP requests with some known cookie key-value pairs (e.g k1=v1; k2=v2; ...
) using wreq, but can't find a convenient way of creating them.
Because Cookie has many fields, I'd prefer a smart constructor than having to fill all fields on my own.
By browsing documents, I find generateCookie to be the most promosing one (and that's also the only one I've found that returns a Cookie
): I can create SetCookie
and all I need are just key value pairs. But we don't have a Request to feed it as the second argument. Using http-client alone, one can do parseUrl to create one. But in wreq I feel the author want to hide Request from user and I can't find a function that gives us direct access to it.
So my question is: are there better ways to create cookies in wreq than using Cookie
constructor?
Upvotes: 3
Views: 123
Reputation: 12123
I'd probably fork the generateCookie
implementation, as it looks like the Request
argument is used only to validate the fields.
http://hackage.haskell.org/package/http-client-0.4.26.2/docs/src/Network-HTTP-Client-Cookies.html#generateCookie, except for default cookie path, as SetCookie
has Maybe
path.
Upvotes: 1