tricycle-rack-contrib 0.9.6 → 0.9.7
Sign up to get free protection for your applications and to get access to all the features.
@@ -16,8 +16,9 @@ class Rack::ResponseCache
|
|
16
16
|
"text/javascript" => %w[js], "application/javascript" => %w[js],
|
17
17
|
"text/plain" => %w[txt],
|
18
18
|
"text/xml" => %w[xml],
|
19
|
+
"text/x-component" => %w[htc],
|
19
20
|
}
|
20
|
-
ALLOWED_EXTENSIONS = CONTENT_TYPES.
|
21
|
+
ALLOWED_EXTENSIONS = CONTENT_TYPES.values.flatten.uniq
|
21
22
|
|
22
23
|
# The default proc used if a block is not provided to .new
|
23
24
|
# Doesn't cache unless path does not contain '..', Content-Type is
|
@@ -129,16 +129,19 @@ context Rack::ResponseCache do
|
|
129
129
|
@cache.should.equal('/a.html' => @def_value)
|
130
130
|
end
|
131
131
|
|
132
|
-
{
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
132
|
+
extensions_fixture = {} # reversed CONTENT_TYPES
|
133
|
+
Rack::ResponseCache::CONTENT_TYPES.each do |mime_type, extensions|
|
134
|
+
extensions.each do |extension|
|
135
|
+
next if extension == "htm" # special behaviour for .htm
|
136
|
+
if extensions_fixture[extension]
|
137
|
+
extensions_fixture[extension] << mime_type
|
138
|
+
else
|
139
|
+
extensions_fixture[extension] = [mime_type]
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
extensions_fixture.each do |extension, mime_types|
|
142
145
|
mime_types.each do |mime_type|
|
143
146
|
specify "should cache #{mime_type} responses with the extension ('#{extension}') unchanged" do
|
144
147
|
request(:path => "/a.#{extension}", :headers => {'CT' => mime_type})
|
@@ -157,7 +160,7 @@ context Rack::ResponseCache do
|
|
157
160
|
@cache.should.equal("/a.htm" => @def_value)
|
158
161
|
end
|
159
162
|
|
160
|
-
|
163
|
+
(extensions_fixture.keys - %w[htm html]).each do |extension|
|
161
164
|
specify "should not cache if extension and content-type don't agree" do
|
162
165
|
request(:path => "/d.#{extension}", :headers => {'CT' => 'text/html'})
|
163
166
|
@cache.should.equal({})
|
@@ -3,8 +3,8 @@ Gem::Specification.new do |s|
|
|
3
3
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
4
4
|
|
5
5
|
s.name = 'tricycle-rack-contrib'
|
6
|
-
s.version = '0.9.
|
7
|
-
s.date = '2010-01-
|
6
|
+
s.version = '0.9.7'
|
7
|
+
s.date = '2010-01-28'
|
8
8
|
|
9
9
|
s.description = "Contributed Rack Middleware and Utilities, including Tricycle's modifications"
|
10
10
|
s.summary = "Contributed Rack Middleware and Utilities, including Tricycle's modifications"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tricycle-rack-contrib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tricycle
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2010-01-
|
13
|
+
date: 2010-01-28 00:00:00 +11:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|