sinatra/sinatra — Issue #418: params hash keys missing in deferred handler
Author: vjoel
Created: 2011-11-22 05:23:40+00:00
State: open

When using stream or async_sinatra, the evaluation of the handler block may happen after process_route cleans up the params hash, resulting in an incorrect params hash as seen by that handler.

```ruby
require 'sinatra'

get "/foo/:x" do
params_before_stream = params.dup
stream do |out|
sleep 0.2
out << "params_before_stream = #{params_before_stream.inspect}\n"
out << "params = #{params.inspect}\n"
end
end
```

After running the above, the following requests show the problem:

```
$ curl 'localhost:4567/foo/3?y=7'
params_before_stream = {"x"=>"3", "y"=>"7"}
params = {"y"=>"7"}
```