简体   繁体   English

如何使用Rest Client在ruby中获取请求的cookie详细信息

[英]How to get cookie details of the request in ruby using rest client

If I am making this get request using rest-client gem 如果我使用rest-client gem发出此get请求

https://www.google.co.in/

I want get the following details:- 我想获得以下详细信息:

  1. cookie 曲奇饼
  2. expire date 到期日期

Also i want to remove the cookie(like we do clear cookies in browser). 我也想删除cookie(就像我们在浏览器中清除cookie)。

How can i do it? 我该怎么做?

You can do the following with rest-client: 您可以使用rest-client执行以下操作:

request = RestClient.get 'https://www.google.co.in/'

then inspect the cookies you have with 然后检查您拥有的Cookie

request.cookies

but from what I've seen there's no expire date. 但据我所知,没有过期日期。

To remove the cookies do the following 要删除cookie,请执行以下操作

request.cookies.clear

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM