lib/sinatra/test.rb in Syd-sinatra-0.9.0.2 vs lib/sinatra/test.rb in Syd-sinatra-0.9.0.4

- old
+ new

@@ -73,23 +73,29 @@ :cookies => "HTTP_COOKIE", :content_type => "CONTENT_TYPE" } def rack_opts(opts) - opts.inject({}) do |hash,(key,val)| + opts.merge(:lint => true).inject({}) do |hash,(key,val)| key = RACK_OPT_NAMES[key] || key hash[key] = val hash end end - def env_for(opts={}) - opts = rack_opts(opts) - Rack::MockRequest.env_for(opts) - end - - def param_string(hash) - hash.map { |pair| pair.map{|v|escape(v)}.join('=') }.join('&') + def param_string(value, prefix = nil) + case value + when Array + value.map { |v| + param_string(v, "#{prefix}[]") + } * "&" + when Hash + value.map { |k, v| + param_string(v, prefix ? "#{prefix}[#{escape(k)}]" : escape(k)) + } * "&" + else + "#{prefix}=#{escape(value)}" + end end if defined? Sinatra::Compat # Deprecated. Use: "get" instead of "get_it". %w(get head post put delete).each do |verb|