http-cookie 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/http/cookie/version.rb +1 -1
- data/lib/http/cookie.rb +3 -1
- data/test/test_http_cookie.rb +15 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 143890479b8951250d5f45d4528c390e03741d943269abe0901e091b544f95ca
|
4
|
+
data.tar.gz: 7bfef9e1bd7cd6cb01f0de248717fade7a1871fb120cd35227657a96c371d384
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba03e3c618d888517bc4bb9e95c08cf4c89bbe5a9ec075d31dcaba353d8864b338fe79bf7ad36f45d6e87a114eefabe41ed62a7b62876c3ba55f459e022fb24f
|
7
|
+
data.tar.gz: 846fa3243f97982df9b196fbc0645d13cd233105bbaa98e2e42b36f5a95b58c07d7571c213c6b35034b4ea41f1ce415857aabbbfe20042305611608fa3d327df
|
data/CHANGELOG.md
CHANGED
data/lib/http/cookie/version.rb
CHANGED
data/lib/http/cookie.rb
CHANGED
@@ -89,7 +89,7 @@ class HTTP::Cookie
|
|
89
89
|
|
90
90
|
# The Expires attribute value as a Time object.
|
91
91
|
#
|
92
|
-
# The setter method accepts a Time object, a string representation
|
92
|
+
# The setter method accepts a Time / DateTime object, a string representation
|
93
93
|
# of date/time that Time.parse can understand, or `nil`.
|
94
94
|
#
|
95
95
|
# Setting this value resets #max_age to nil. When #max_age is
|
@@ -493,6 +493,8 @@ class HTTP::Cookie
|
|
493
493
|
def expires= t
|
494
494
|
case t
|
495
495
|
when nil, Time
|
496
|
+
when DateTime
|
497
|
+
t = t.to_time
|
496
498
|
else
|
497
499
|
t = Time.parse(t)
|
498
500
|
end
|
data/test/test_http_cookie.rb
CHANGED
@@ -717,8 +717,22 @@ class TestHTTPCookie < Test::Unit::TestCase
|
|
717
717
|
end
|
718
718
|
|
719
719
|
def test_expiration
|
720
|
-
|
720
|
+
expires = Time.now + 86400
|
721
|
+
cookie = HTTP::Cookie.new(cookie_values(expires: expires))
|
722
|
+
|
723
|
+
assert_equal(expires, cookie.expires)
|
724
|
+
assert_equal false, cookie.expired?
|
725
|
+
assert_equal true, cookie.expired?(cookie.expires + 1)
|
726
|
+
assert_equal false, cookie.expired?(cookie.expires - 1)
|
727
|
+
cookie.expire!
|
728
|
+
assert_equal true, cookie.expired?
|
729
|
+
end
|
730
|
+
|
731
|
+
def test_expiration_using_datetime
|
732
|
+
expires = DateTime.now + 1
|
733
|
+
cookie = HTTP::Cookie.new(cookie_values(expires: expires))
|
721
734
|
|
735
|
+
assert_equal(expires.to_time, cookie.expires)
|
722
736
|
assert_equal false, cookie.expired?
|
723
737
|
assert_equal true, cookie.expired?(cookie.expires + 1)
|
724
738
|
assert_equal false, cookie.expired?(cookie.expires - 1)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: http-cookie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Akinori MUSHA
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2024-
|
14
|
+
date: 2024-12-05 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: domain_name
|
@@ -173,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
173
173
|
- !ruby/object:Gem::Version
|
174
174
|
version: '0'
|
175
175
|
requirements: []
|
176
|
-
rubygems_version: 3.5.
|
176
|
+
rubygems_version: 3.5.22
|
177
177
|
signing_key:
|
178
178
|
specification_version: 4
|
179
179
|
summary: A Ruby library to handle HTTP Cookies based on RFC 6265
|