-
Notifications
You must be signed in to change notification settings - Fork 321
Cookies
No GUI edited this page Apr 7, 2018
·
13 revisions
The HTTP.cookies
option can be used to configure cookies for a given request:
response = HTTP.cookies(:session_cookie => "dXNlcl9pZD0xO21hYz1iY2NlYT...")
.get("https://www.example.com")
This gem uses the sparklemotion/http-cookie library to provide HTTP::Cookie
and HTTP::CookieJar
classes. To obtain the cookie jar for a given response, call the #cookies
method:
>> response = HTTP.get("https://www.google.com")
=> #<HTTP::Response/1.1 200 OK [...]>
>> response.cookies
=> #<HTTP::CookieJar:0x007fe48c245a40 @jar={"google.com"=>{"/"=>{"NID"=>#<HTTP::Cookie:name="NID", value="77=MhhSY6nnIUwA[...]">>