rack 1.6.6 → 1.6.7
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rack might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/rack.rb +1 -1
- data/lib/rack/mock.rb +23 -7
- data/rack.gemspec +1 -1
- data/test/spec_mock.rb +20 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 065b2269ac4d6c8df5afe4c6fe2867453135cf56
|
4
|
+
data.tar.gz: de8403605f28f65e5cfe788e2ca3b075cc1a2729
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40dcd3ec3c36f816fd19e8dfcaf2dba2a25a0632e220617c41093ebdf8aeaeefb2b15901d5970487b71a37ffd88898369ac4d6bf9ee3bc897cd990d8fea3471d
|
7
|
+
data.tar.gz: 49595d3d9464fcbc8307478e25e772dd08abed0fd17c073e26abe1630d00eb3231cc55a250b1ad52f41ded2a62b2845ccd326cc9855a38420541fcfb5b7ad1d4
|
data/lib/rack.rb
CHANGED
data/lib/rack/mock.rb
CHANGED
@@ -91,13 +91,7 @@ module Rack
|
|
91
91
|
|
92
92
|
env = DEFAULT_ENV.dup
|
93
93
|
|
94
|
-
env
|
95
|
-
env["SERVER_NAME"] = uri.host || "example.org"
|
96
|
-
env["SERVER_PORT"] = uri.port ? uri.port.to_s : "80"
|
97
|
-
env[QUERY_STRING] = uri.query.to_s
|
98
|
-
env[PATH_INFO] = (!uri.path || uri.path.empty?) ? "/" : uri.path
|
99
|
-
env["rack.url_scheme"] = uri.scheme || "http"
|
100
|
-
env["HTTPS"] = env["rack.url_scheme"] == "https" ? "on" : "off"
|
94
|
+
env_with_encoding(env, opts, uri)
|
101
95
|
|
102
96
|
env[SCRIPT_NAME] = opts[:script_name] || ""
|
103
97
|
|
@@ -148,6 +142,28 @@ module Rack
|
|
148
142
|
|
149
143
|
env
|
150
144
|
end
|
145
|
+
|
146
|
+
if "<3".respond_to? :encoding
|
147
|
+
def self.env_with_encoding(env, opts, uri)
|
148
|
+
env[REQUEST_METHOD] = (opts[:method] ? opts[:method].to_s.upcase : "GET").b
|
149
|
+
env["SERVER_NAME"] = (uri.host || "example.org").b
|
150
|
+
env["SERVER_PORT"] = (uri.port ? uri.port.to_s : "80").b
|
151
|
+
env[QUERY_STRING] = (uri.query.to_s).b
|
152
|
+
env[PATH_INFO] = ((!uri.path || uri.path.empty?) ? "/" : uri.path).b
|
153
|
+
env["rack.url_scheme"] = (uri.scheme || "http").b
|
154
|
+
env["HTTPS"] = (env["rack.url_scheme"] == "https" ? "on" : "off").b
|
155
|
+
end
|
156
|
+
else
|
157
|
+
def self.env_with_encoding(env, opts, uri)
|
158
|
+
env[REQUEST_METHOD] = opts[:method] ? opts[:method].to_s.upcase : "GET"
|
159
|
+
env["SERVER_NAME"] = uri.host || "example.org"
|
160
|
+
env["SERVER_PORT"] = uri.port ? uri.port.to_s : "80"
|
161
|
+
env[QUERY_STRING] = uri.query.to_s
|
162
|
+
env[PATH_INFO] = (!uri.path || uri.path.empty?) ? "/" : uri.path
|
163
|
+
env["rack.url_scheme"] = uri.scheme || "http"
|
164
|
+
env["HTTPS"] = env["rack.url_scheme"] == "https" ? "on" : "off"
|
165
|
+
end
|
166
|
+
end
|
151
167
|
end
|
152
168
|
|
153
169
|
# Rack::MockResponse provides useful helpers for testing your apps.
|
data/rack.gemspec
CHANGED
data/test/spec_mock.rb
CHANGED
@@ -211,6 +211,26 @@ describe Rack::MockRequest do
|
|
211
211
|
Rack::MockRequest.new(capp).get('/', :lint => true)
|
212
212
|
called.should.equal true
|
213
213
|
end
|
214
|
+
|
215
|
+
unless "<3".respond_to? :encoding
|
216
|
+
should "defaults encoding to ASCII 8BIT" do
|
217
|
+
req = Rack::MockRequest.env_for("/foo")
|
218
|
+
|
219
|
+
keys = [
|
220
|
+
Rack::REQUEST_METHOD,
|
221
|
+
"SERVER_NAME",
|
222
|
+
"SERVER_PORT",
|
223
|
+
Rack::QUERY_STRING,
|
224
|
+
Rack::PATH_INFO,
|
225
|
+
"rack.url_scheme",
|
226
|
+
"HTTPS"
|
227
|
+
]
|
228
|
+
|
229
|
+
keys.each do |k|
|
230
|
+
req[k].encoding.should.equal Encoding::ASCII_8BIT
|
231
|
+
end
|
232
|
+
end
|
233
|
+
end
|
214
234
|
end
|
215
235
|
|
216
236
|
describe Rack::MockResponse do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Neukirchen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bacon
|