Fix env handling for Rack 2

rack#b2d73960e9ea6b8b15321ef190f13a290d1aedf0 introduces the relevant change -
In previous versions, `request.rack_request.dup.env` was still the same object
as `request.rack_request.env` and so updates to it did update the original
rack env, which appears to be behavior that we're depending on elsewhere.

Given that we'll often want to update the env (see e.g.  hanami/controller's
handling of `env['hanami.action']`), I'm struggling to understand why the
`dup` was there in the first place. But in any case, this gets the tests
back passing on Rack '~> 2.0'.
This commit is contained in:
James Dabbs 2016-07-26 08:51:35 -04:00
parent bddf4fbdf6
commit cf28f5db80
1 changed files with 1 additions and 1 deletions

View File

@ -29,7 +29,7 @@ class HttpRouter
request.called = true
callback.call(Response.new(request, #{path_ivar}))
else
env = request.rack_request.dup.env
env = request.rack_request.env
env['router.request'] = request
env['router.params'] ||= {}
#{"env['router.params'].merge!(Hash[#{param_names.inspect}.zip(request.params)])" if dynamic?}