Skip to content

Commit

Permalink
Fix usage of lambda as a Rack endpoint
Browse files Browse the repository at this point in the history
The response body needs to respond_to? :each.
  • Loading branch information
jiripospisil committed Dec 31, 2012
1 parent 5e51074 commit dbacb95
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions actionpack/lib/action_dispatch/routing/mapper.rb
Expand Up @@ -315,7 +315,7 @@ def root(options = {})
# A pattern can also point to a +Rack+ endpoint i.e. anything that
# responds to +call+:
#
# match 'photos/:id', to: lambda {|hash| [200, {}, "Coming soon"] }
# match 'photos/:id', to: lambda {|hash| [200, {}, ["Coming soon"]] }
# match 'photos/:id', to: PhotoRackApp
# # Yes, controller actions are just rack endpoints
# match 'photos/:id', to: PhotosController.action(:show)
Expand Down Expand Up @@ -360,7 +360,7 @@ def root(options = {})
# +call+ or a string representing a controller's action.
#
# match 'path', to: 'controller#action'
# match 'path', to: lambda { |env| [200, {}, "Success!"] }
# match 'path', to: lambda { |env| [200, {}, ["Success!"]] }
# match 'path', to: RackApp
#
# [:on]
Expand Down
2 changes: 1 addition & 1 deletion railties/test/application/assets_test.rb
Expand Up @@ -45,7 +45,7 @@ def assert_no_file_exists(filename)

app_file 'config/routes.rb', <<-RUBY
AppTemplate::Application.routes.draw do
get '*path', to: lambda { |env| [200, { "Content-Type" => "text/html" }, "Not an asset"] }
get '*path', to: lambda { |env| [200, { "Content-Type" => "text/html" }, ["Not an asset"]] }
end
RUBY

Expand Down
2 changes: 1 addition & 1 deletion railties/test/railties/engine_test.rb
Expand Up @@ -568,7 +568,7 @@ class Engine < ::Rails::Engine
@plugin.write "lib/bukkits.rb", <<-RUBY
module Bukkits
class Engine < ::Rails::Engine
endpoint lambda { |env| [200, {'Content-Type' => 'text/html'}, 'hello'] }
endpoint lambda { |env| [200, {'Content-Type' => 'text/html'}, ['hello']] }
end
end
RUBY
Expand Down

0 comments on commit dbacb95

Please sign in to comment.