http_router 0.7.7 → 0.7.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/http_router/node/arbitrary.rb +4 -6
- data/lib/http_router/route.rb +1 -1
- data/lib/http_router/version.rb +1 -1
- data/test/test_arbitrary.rb +0 -8
- metadata +3 -3
@@ -11,12 +11,10 @@ class HttpRouter
|
|
11
11
|
|
12
12
|
def [](request)
|
13
13
|
if request.path.empty? or (request.path.size == 1 and request.path[0] == '') or @allow_partial
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
@blk.call(request, params)
|
19
|
-
end
|
14
|
+
request = request.clone
|
15
|
+
request.continue = proc { |state| node_lookup(request) if state }
|
16
|
+
params = @param_names.nil? ? {} : Hash[@param_names.zip(request.params)]
|
17
|
+
@blk.call(request, params)
|
20
18
|
end
|
21
19
|
end
|
22
20
|
|
data/lib/http_router/route.rb
CHANGED
@@ -273,7 +273,7 @@ class HttpRouter
|
|
273
273
|
router.pass_on_response(response) ? throw(:pass) : throw(:success, response)
|
274
274
|
elsif req.acceptance_test
|
275
275
|
response = Response.new(req, path_obj)
|
276
|
-
req.acceptance_test[response]
|
276
|
+
catch(:pass) { req.acceptance_test[response] }
|
277
277
|
throw :success, response if response.acceptance_response
|
278
278
|
else
|
279
279
|
throw :success, Response.new(req, path_obj)
|
data/lib/http_router/version.rb
CHANGED
data/test/test_arbitrary.rb
CHANGED
@@ -48,14 +48,6 @@ class TestArbitrary < MiniTest::Unit::TestCase
|
|
48
48
|
assert_route r, '/test', {:test => 'test'}
|
49
49
|
end
|
50
50
|
|
51
|
-
def test_passing
|
52
|
-
never, route = router {
|
53
|
-
add('test').arbitrary(Proc.new{|req, params| throw :pass })
|
54
|
-
add("test")
|
55
|
-
}
|
56
|
-
assert_route route, 'http://lovelove:8080/test'
|
57
|
-
end
|
58
|
-
|
59
51
|
def test_continue
|
60
52
|
no, yes = router {
|
61
53
|
add('test').arbitrary_with_continue{|req, p| req.continue[false]}
|
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: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 7
|
9
|
-
-
|
10
|
-
version: 0.7.
|
9
|
+
- 8
|
10
|
+
version: 0.7.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Joshua Hull
|