rack-test 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/History.md +14 -0
- data/lib/rack/test/cookie_jar.rb +9 -10
- data/lib/rack/test/uploaded_file.rb +0 -14
- data/lib/rack/test/version.rb +1 -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: 2c648ce9c6c053f9168116fa0ff70ac3ce4d6944326cca519fc2f7f1bb3c4f1d
|
4
|
+
data.tar.gz: 8c8d8c7b5c41facc400a1f95533af2e94c7c6eb42ed55ba92b5e38689134e3d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5414edd21a3f105513f6068d799fd25fd61672dcd50d0eedbb04b8e05e5224f62f9fcd5014456c99b17ae02c86e38e16077cce27b2c04bcc285214bb49213d45
|
7
|
+
data.tar.gz: 5f21ac1f5f8ee2f82d6c3ce65e0cb88ed66e055178c120b935be24a838ee1fc126d1a6070ea4833626e314d631c052748eccdce66db801bfafda01d7bc9c2b42
|
data/History.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
## 2.2.0 / 2024-12-23
|
2
|
+
|
3
|
+
* Bug fixes:
|
4
|
+
* `Rack::Test::Cookie` now parses cookie parameters using a
|
5
|
+
case-insensitive approach (Guillaume Malette #349)
|
6
|
+
|
7
|
+
* Minor enhancements:
|
8
|
+
* Arrays of cookies containing a blank cookie are now handled
|
9
|
+
correctly when processing responses. (Martin Emde #343)
|
10
|
+
* `Rack::Test::UploadedFile` no longer uses a finalizer for named
|
11
|
+
paths to close and unlink the created Tempfile. Tempfile itself
|
12
|
+
uses a finalizer to close and unlink itself, so there is no
|
13
|
+
reason for `Rack::Test::UploadedFile` to do so (Jeremy Evans #338)
|
14
|
+
|
1
15
|
## 2.1.0 / 2023-03-14
|
2
16
|
|
3
17
|
* Breaking changes:
|
data/lib/rack/test/cookie_jar.rb
CHANGED
@@ -12,7 +12,7 @@ module Rack
|
|
12
12
|
|
13
13
|
# The name of the cookie, will be a string
|
14
14
|
attr_reader :name
|
15
|
-
|
15
|
+
|
16
16
|
# The value of the cookie, will be a string or nil if there is no value.
|
17
17
|
attr_reader :value
|
18
18
|
|
@@ -28,7 +28,7 @@ module Rack
|
|
28
28
|
@raw, options = raw.split(/[;,] */n, 2)
|
29
29
|
|
30
30
|
@name, @value = parse_query(@raw, ';').to_a.first
|
31
|
-
@options = parse_query(options, ';')
|
31
|
+
@options = Hash[parse_query(options, ';').map { |k, v| [k.downcase, v] }]
|
32
32
|
|
33
33
|
if domain = @options['domain']
|
34
34
|
@exact_domain_match = false
|
@@ -69,7 +69,7 @@ module Rack
|
|
69
69
|
# Whether the cookie has the httponly flag, indicating it is not available via
|
70
70
|
# a javascript API.
|
71
71
|
def http_only?
|
72
|
-
@options.key?('
|
72
|
+
@options.key?('httponly')
|
73
73
|
end
|
74
74
|
|
75
75
|
# The explicit or implicit path for the cookie.
|
@@ -93,9 +93,8 @@ module Rack
|
|
93
93
|
|
94
94
|
uri.host = @default_host if uri.host.nil?
|
95
95
|
|
96
|
-
real_domain = domain =~ /^\./ ? domain[1..-1] : domain
|
97
96
|
!!((!secure? || (secure? && uri.scheme == 'https')) &&
|
98
|
-
uri.host =~ Regexp.new("#{'^' if @exact_domain_match}#{Regexp.escape(
|
97
|
+
uri.host =~ Regexp.new("#{'^' if @exact_domain_match}#{Regexp.escape(domain)}$", Regexp::IGNORECASE))
|
99
98
|
end
|
100
99
|
|
101
100
|
# Cookies that do not match the URI will not be sent in requests to the URI.
|
@@ -110,11 +109,13 @@ module Rack
|
|
110
109
|
|
111
110
|
# A hash of cookie options, including the cookie value, but excluding the cookie name.
|
112
111
|
def to_h
|
113
|
-
@options.merge(
|
112
|
+
hash = @options.merge(
|
114
113
|
'value' => @value,
|
115
114
|
'HttpOnly' => http_only?,
|
116
115
|
'secure' => secure?
|
117
116
|
)
|
117
|
+
hash.delete('httponly')
|
118
|
+
hash
|
118
119
|
end
|
119
120
|
alias to_hash to_h
|
120
121
|
|
@@ -183,12 +184,10 @@ module Rack
|
|
183
184
|
def merge(raw_cookies, uri = nil)
|
184
185
|
return unless raw_cookies
|
185
186
|
|
186
|
-
if raw_cookies.is_a? String
|
187
|
-
raw_cookies = raw_cookies.split("\n")
|
188
|
-
raw_cookies.reject!(&:empty?)
|
189
|
-
end
|
187
|
+
raw_cookies = raw_cookies.split("\n") if raw_cookies.is_a? String
|
190
188
|
|
191
189
|
raw_cookies.each do |raw_cookie|
|
190
|
+
next if raw_cookie.empty?
|
192
191
|
cookie = Cookie.new(raw_cookie, uri, @default_host)
|
193
192
|
self << cookie if cookie.valid?(uri)
|
194
193
|
end
|
@@ -72,18 +72,6 @@ module Rack
|
|
72
72
|
tempfile.respond_to?(method_name, include_private) || super
|
73
73
|
end
|
74
74
|
|
75
|
-
# A proc that can be used as a finalizer to close and unlink the tempfile.
|
76
|
-
def self.finalize(file)
|
77
|
-
proc { actually_finalize file }
|
78
|
-
end
|
79
|
-
|
80
|
-
# Close and unlink the given file, used as a finalizer for the tempfile,
|
81
|
-
# if the tempfile is backed by a file in the filesystem.
|
82
|
-
def self.actually_finalize(file)
|
83
|
-
file.close
|
84
|
-
file.unlink
|
85
|
-
end
|
86
|
-
|
87
75
|
private
|
88
76
|
|
89
77
|
# Use the StringIO as the tempfile.
|
@@ -104,8 +92,6 @@ module Rack
|
|
104
92
|
@tempfile = Tempfile.new([::File.basename(@original_filename, extension), extension])
|
105
93
|
@tempfile.set_encoding(Encoding::BINARY)
|
106
94
|
|
107
|
-
ObjectSpace.define_finalizer(self, self.class.finalize(@tempfile))
|
108
|
-
|
109
95
|
FileUtils.copy_file(path, @tempfile.path)
|
110
96
|
end
|
111
97
|
end
|
data/lib/rack/test/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-test
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Evans
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-12-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
@@ -110,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '0'
|
112
112
|
requirements: []
|
113
|
-
rubygems_version: 3.
|
113
|
+
rubygems_version: 3.5.22
|
114
114
|
signing_key:
|
115
115
|
specification_version: 4
|
116
116
|
summary: Simple testing API built on Rack
|