lib/rack/app/instance_methods/http_control.rb in rack-app-4.0.1 vs lib/rack/app/instance_methods/http_control.rb in rack-app-5.0.0.rc1

- old
+ new

@@ -1,11 +1,19 @@ module Rack::App::InstanceMethods::HttpControl - def redirect_to(url) - url = "#{url}?#{request.env['QUERY_STRING']}" unless request.env['QUERY_STRING'].empty? + def redirect_to(url, params={}) + + if params.empty? + url = [url, request.env['QUERY_STRING']].join('?') unless request.env['QUERY_STRING'].empty? + else + query_string = Rack::App::Utils.encode_www_form(params.to_a) + url = [url, query_string].join('?') + end + response.status = 301 response.headers.merge!({'Location' => url}) - 'See Ya!' + + finish_response + end end -