I need to get cookie value stored when making a request below:-
http://www.google.com
and also clear the cookie and then create a cookie by making a new request
Example:-
I am making this request:-
http://www.google.com
Sample cookie stored like below:-
Name: AID
Content: AJHaeXK3Vn1wJpwSo6hSbO9wWd_qlgczYqbEz-ushHQ
Domain: .google.com
Path: /ads
Send for: Any kind of connection
Accessible to script: No (HttpOnly)
Created: Wednesday, December 24, 2014 at 11:58:15 AM
Expires: Wednesday, June 15, 2016 at 12:30:00 PM
I want to get above details by using rest-client.
I need to clear above cookie which is stored and then make a new request.
From what I see the cookie you've got from the rest-client doesn't have the whole information you posted:
{"PREF"=>"ID%3Da7ef052f0ef59efe%3AFF%3D0%3ATM%3D1419955587%3ALM%3D1419955587%3AS%3D1ieKQTEkT506sNXV", "domain"=>".google.pt", "NID"=>"67%3DbC3Y1L2DMHd_ZgpbnUjECoIeeRfFZixAeELI7nuT3f7LDFotI5xmGEu-FqO8O4456f1tQAim_d5KvjrLRApFGEk3lhAE7JXM3aI0DS1q6Pgl_0ahoVM_SvaXHgEQLt_5"}
But to achieve what you want (clear the cookie to make a new request) you can use this:
request = RestClient.get 'https://www.google.com'
request.cookies.clear