Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

test and fix #call example

  • Loading branch information...
commit 039675f4b41176f56bcd167715714c95f338b050 1 parent 97620ef
Konstantin Haase rkh authored
2  README.de.rdoc
View
@@ -909,7 +909,7 @@ anderen Route gefordert wird. Um das zu erreichen, lässt sich +call+ nutzen:
get '/foo' do
status, headers, body = call env.merge("PATH_INFO" => '/bar')
- [status, body.upcase]
+ [status, headers, body.map(&:upcase)]
end
get '/bar' do
2  README.es.rdoc
View
@@ -884,7 +884,7 @@ servir. Para lograr esto, podés usar +call+:
get '/foo' do
status, headers, body = call env.merge("PATH_INFO" => '/bar')
- [status, body.upcase]
+ [status, headers, body.map(&:upcase)]
end
get '/bar' do
2  README.fr.rdoc
View
@@ -912,7 +912,7 @@ simplement +call+ :
get '/foo' do
status, headers, body = call env.merge("PATH_INFO" => '/bar')
- [status, body.upcase]
+ [status, headers, body.map(&:upcase)]
end
get '/bar' do
2  README.rdoc
View
@@ -864,7 +864,7 @@ of calling another route. Simply use +call+ to achieve this:
get '/foo' do
status, headers, body = call env.merge("PATH_INFO" => '/bar')
- [status, body.upcase]
+ [status, headers, body.map(&:upcase)]
end
get '/bar' do
2  README.ru.rdoc
View
@@ -859,7 +859,7 @@ Thin - это более производительный и функциона
get '/foo' do
status, headers, body = call env.merge("PATH_INFO" => '/bar')
- [status, body.upcase]
+ [status, headers, body.map(&:upcase)]
end
get '/bar' do
2  README.zh.rdoc
View
@@ -844,7 +844,7 @@ Session被用来在请求之间保持状态。如果被激活,每一个用户
get '/foo' do
status, headers, body = call env.merge("PATH_INFO" => '/bar')
- [status, body.upcase]
+ [status, headers, body.map(&:upcase)]
end
get '/bar' do
17 test/routing_test.rb
View
@@ -1043,6 +1043,23 @@ def authorize(username, password)
assert not_found?
end
+ it 'allows using call to fire another request internally' do
+ mock_app do
+ get '/foo' do
+ status, headers, body = call env.merge("PATH_INFO" => '/bar')
+ [status, headers, body.map(&:upcase)]
+ end
+
+ get '/bar' do
+ "bar"
+ end
+ end
+
+ get '/foo'
+ assert ok?
+ assert_body "BAR"
+ end
+
it 'plays well with other routing middleware' do
middleware = Sinatra.new
inner_app = Sinatra.new { get('/foo') { 'hello' } }
Please sign in to comment.
Something went wrong with that request. Please try again.