Skip to content

Loading…

params hash keys missing in deferred handler #418

Closed
vjoel opened this Issue · 0 comments

2 participants

@vjoel

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.

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"}
@rkh rkh was assigned
@rkh rkh closed this in 26cfcc2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.