miyagawa / faraday-cookie_jar

Client-side cookie management for Faraday
MIT License
76 stars 12 forks source link

Access cookie jar directly? #9

Closed markquezada closed 10 years ago

markquezada commented 10 years ago

Hi, is it possible to access the HTTP::Cookie instance directly from the response object? I'd like to be able to store a cookie for use in a later request.

I noticed on initialization this middleware is checking for options[:jar] but I can't figure out how to set that via the faraday connection block. Setting conn.options.jar to an HTTP::Cookie instance doesn't work.

Any help pointing me in the right direction would be greatly appreciated!

miyagawa commented 10 years ago

You can pass the cookie jar object as in conn.use :cookie_jar, jar: cookie_jar

See the spec file for more example. On Oct 13, 2014 3:15 AM, "markquezada" notifications@github.com wrote:

Hi, is it possible to access the HTTP::Cookie instance directly from the response object? I'd like to be able to store a cookie for use in a later request.

I noticed on initialization this middleware is checking for options[:jar] but I can't figure out how to set that via the faraday connection block. Setting conn.options.jar to an HTTP::Cookie instance doesn't work.

Any help pointing me in the right direction would be greatly appreciated!

— Reply to this email directly or view it on GitHub https://github.com/miyagawa/faraday-cookie_jar/issues/9.

markquezada commented 10 years ago

Great, thank you!