Skip to content

Commit

Permalink
extract request allocation from the main app serving routine
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed May 23, 2014
1 parent 0735f8e commit aaceca6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions actionpack/lib/action_dispatch/journey/router.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ def initialize(routes, options)

def call(env)
req = request_class.new(env)

req.path_info = Utils.normalize_path(req.path_info)
serve req
end

def serve(req)
find_routes(req).each do |match, parameters, route|
set_params = req.path_parameters
path_info = req.path_info
Expand All @@ -46,7 +48,7 @@ def call(env)

req.path_parameters = set_params.merge parameters

status, headers, body = route.app.call(env)
status, headers, body = route.app.call(req.env)

if 'pass' == headers['X-Cascade']
req.script_name = script_name
Expand Down
1 change: 1 addition & 0 deletions actionpack/test/dispatch/routing_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3369,6 +3369,7 @@ def expected_redirect_body(url)
class TestAltApp < ActionDispatch::IntegrationTest
class AltRequest
attr_accessor :path_parameters, :path_info, :script_name
attr_reader :env

def initialize(env)
@path_parameters = {}
Expand Down

0 comments on commit aaceca6

Please sign in to comment.