Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix usage of lambda as a Rack endpoint #8666

Merged
merged 1 commit into from

2 participants

@jiripospisil

The response body needs to respond_to? :each. This is probably a leftover from the 1.8 days.

@jiripospisil jiripospisil Fix usage of lambda as a Rack endpoint
The response body needs to respond_to? :each.
dbacb95
@spastorino spastorino merged commit cf2dcf4 into rails:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 31, 2012
  1. @jiripospisil

    Fix usage of lambda as a Rack endpoint

    jiripospisil authored
    The response body needs to respond_to? :each.
This page is out of date. Refresh to see the latest.
View
4 actionpack/lib/action_dispatch/routing/mapper.rb
@@ -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)
@@ -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]
View
2  railties/test/application/assets_test.rb
@@ -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
View
2  railties/test/railties/engine_test.rb
@@ -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
Something went wrong with that request. Please try again.