http_router 0.5.3 → 0.5.4
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.
- data/lib/http_router/node.rb +10 -1
- data/lib/http_router/version.rb +1 -1
- data/test/test_misc.rb +2 -2
- metadata +4 -4
data/lib/http_router/node.rb
CHANGED
@@ -202,7 +202,16 @@ class HttpRouter
|
|
202
202
|
end
|
203
203
|
end if node.value
|
204
204
|
when :nocall, :nocall_with_trailing_slash
|
205
|
-
|
205
|
+
responses = node.value.select do |path|
|
206
|
+
matched = if path.route.partially_match?
|
207
|
+
true
|
208
|
+
elsif (parts and (action == :nocall_with_trailing_slash) and (router.ignore_trailing_slash? or (parts.size == 1 and parts.first == ''))) or parts.nil? || parts.empty?
|
209
|
+
true
|
210
|
+
else
|
211
|
+
false
|
212
|
+
end
|
213
|
+
end
|
214
|
+
throw :response, responses.map{|r| Response.new(r, params)} unless responses.empty?
|
206
215
|
else
|
207
216
|
raise
|
208
217
|
end
|
data/lib/http_router/version.rb
CHANGED
data/test/test_misc.rb
CHANGED
@@ -14,8 +14,8 @@ class TestMisc < MiniTest::Unit::TestCase
|
|
14
14
|
r2.add('/test2').name(:test).to(:test2)
|
15
15
|
assert_equal 2, r2.routes.size
|
16
16
|
|
17
|
-
assert r1.recognize(Rack::MockRequest.env_for('/test2')).nil?
|
18
|
-
assert !r2.recognize(Rack::MockRequest.env_for('/test2')).nil?
|
17
|
+
assert r1.recognize(Rack::Request.new(Rack::MockRequest.env_for('/test2'))).nil?
|
18
|
+
assert !r2.recognize(Rack::Request.new(Rack::MockRequest.env_for('/test2'))).nil?
|
19
19
|
assert_equal r1.routes.first, r1.named_routes[:test_route]
|
20
20
|
assert_equal r2.routes.first, r2.named_routes[:test_route]
|
21
21
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: http_router
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 4
|
10
|
+
version: 0.5.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Joshua Hull
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-02-28 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|