mirror of
https://github.com/samsonjs/http-cookie.git
synced 2026-03-25 08:55:53 +00:00
Update cookie.rb to handle situations when expires is a DateTime object
The standard Selenium WebDriver response is to return an object which has an expiry in datetime format. In order to most effectively work with Selenium, and to provide the smallest barrier possible, co-erce the DateTime object into a Time object and then store it as a HTTP Cookie
This commit is contained in:
parent
9efa5792ba
commit
d2890896e7
1 changed files with 3 additions and 1 deletions
|
|
@ -89,7 +89,7 @@ class HTTP::Cookie
|
|||
|
||||
# The Expires attribute value as a Time object.
|
||||
#
|
||||
# The setter method accepts a Time object, a string representation
|
||||
# The setter method accepts a Time / DateTime object, a string representation
|
||||
# of date/time that Time.parse can understand, or `nil`.
|
||||
#
|
||||
# Setting this value resets #max_age to nil. When #max_age is
|
||||
|
|
@ -493,6 +493,8 @@ class HTTP::Cookie
|
|||
def expires= t
|
||||
case t
|
||||
when nil, Time
|
||||
when DateTime
|
||||
t = t.to_time
|
||||
else
|
||||
t = Time.parse(t)
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue