aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/http/request.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2015-08-24 14:57:05 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2015-08-24 14:57:05 -0700
commitc4c5918b688da1ca00be34e3c66fcc5ca78500b1 (patch)
treed14c0487b86f3f03ced98bf30157ee05aaed2ff6 /actionpack/lib/action_dispatch/http/request.rb
parentec9c237acc1f140df464e824d9e28c78c96837e7 (diff)
downloadrails-c4c5918b688da1ca00be34e3c66fcc5ca78500b1.tar.gz
rails-c4c5918b688da1ca00be34e3c66fcc5ca78500b1.tar.bz2
rails-c4c5918b688da1ca00be34e3c66fcc5ca78500b1.zip
stop using `@env` in the GET / POST methods
I want to implement this with something besides `@env` in the future, so lets stop directly referencing it.
Diffstat (limited to 'actionpack/lib/action_dispatch/http/request.rb')
-rw-r--r--actionpack/lib/action_dispatch/http/request.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb
index 4748a54550..b9fc703fe2 100644
--- a/actionpack/lib/action_dispatch/http/request.rb
+++ b/actionpack/lib/action_dispatch/http/request.rb
@@ -323,7 +323,9 @@ module ActionDispatch
# Override Rack's GET method to support indifferent access
def GET
- @env["action_dispatch.request.query_parameters"] ||= normalize_encode_params(super || {})
+ get_header("action_dispatch.request.query_parameters") do |k|
+ set_header k, normalize_encode_params(super || {})
+ end
rescue Rack::Utils::ParameterTypeError, Rack::Utils::InvalidParameterError => e
raise ActionController::BadRequest.new(:query, e)
end
@@ -331,7 +333,9 @@ module ActionDispatch
# Override Rack's POST method to support indifferent access
def POST
- @env["action_dispatch.request.request_parameters"] ||= normalize_encode_params(super || {})
+ get_header("action_dispatch.request.request_parameters") do |k|
+ self.request_parameters = normalize_encode_params(super || {})
+ end
rescue Rack::Utils::ParameterTypeError, Rack::Utils::InvalidParameterError => e
raise ActionController::BadRequest.new(:request, e)
end
@@ -352,6 +356,7 @@ module ActionDispatch
end
def request_parameters=(params)
+ raise if params.nil?
set_header("action_dispatch.request.request_parameters".freeze, params)
end