aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r--actionpack/lib/action_dispatch/http/response.rb20
-rw-r--r--actionpack/lib/action_dispatch/test/mock.rb12
2 files changed, 18 insertions, 14 deletions
diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb
index ebba4eefa0..d104dcb8a0 100644
--- a/actionpack/lib/action_dispatch/http/response.rb
+++ b/actionpack/lib/action_dispatch/http/response.rb
@@ -34,15 +34,30 @@ module ActionDispatch # :nodoc:
DEFAULT_HEADERS = { "Cache-Control" => "no-cache" }
attr_accessor :request
- attr_accessor :assigns, :template, :layout
attr_accessor :redirected_to, :redirected_to_method_params
attr_writer :header
alias_method :headers=, :header=
+ def template
+ ActiveSupport::Deprecation.warn("response.template has been deprecated. Use controller.template instead", caller)
+ @template
+ end
+ attr_writer :template
+
def session
ActiveSupport::Deprecation.warn("response.session has been deprecated. Use request.session instead", caller)
- request.session
+ @request.session
+ end
+
+ def assigns
+ ActiveSupport::Deprecation.warn("response.assigns has been deprecated. Use controller.assigns instead", caller)
+ @template.controller.assigns
+ end
+
+ def layout
+ ActiveSupport::Deprecation.warn("response.layout has been deprecated. Use template.layout instead", caller)
+ @template.layout
end
delegate :default_charset, :to => 'ActionController::Base'
@@ -50,7 +65,6 @@ module ActionDispatch # :nodoc:
def initialize
super
@header = Rack::Utils::HeaderHash.new(DEFAULT_HEADERS)
- @session, @assigns = [], []
end
# The response code of the request
diff --git a/actionpack/lib/action_dispatch/test/mock.rb b/actionpack/lib/action_dispatch/test/mock.rb
index 8dc048af11..4042f9fbc8 100644
--- a/actionpack/lib/action_dispatch/test/mock.rb
+++ b/actionpack/lib/action_dispatch/test/mock.rb
@@ -5,8 +5,6 @@ module ActionDispatch
class << self
def env_for(path, opts)
- headers = opts.delete(:headers)
-
method = (opts[:method] || opts["REQUEST_METHOD"]).to_s.upcase
opts[:method] = opts["REQUEST_METHOD"] = method
@@ -48,15 +46,7 @@ module ActionDispatch
uri.query = requestify(params)
end
- env = ::Rack::MockRequest.env_for(uri.to_s, opts)
-
- (headers || {}).each do |key, value|
- key = key.to_s.upcase.gsub(/-/, "_")
- key = "HTTP_#{key}" unless env.has_key?(key) || key =~ /^HTTP_/
- env[key] = value
- end
-
- env
+ ::Rack::MockRequest.env_for(uri.to_s, opts)
end
private