mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Show in log correct wrapped keys
This commit is contained in:
parent
da97cf016a
commit
32a433e1c0
2 changed files with 10 additions and 1 deletions
|
@ -193,7 +193,8 @@ module ActionController
|
|||
def process_action(*args)
|
||||
if _wrapper_enabled?
|
||||
wrapped_hash = _wrap_parameters request.request_parameters
|
||||
wrapped_filtered_hash = _wrap_parameters request.filtered_parameters
|
||||
wrapped_keys = request.request_parameters.keys
|
||||
wrapped_filtered_hash = _wrap_parameters request.filtered_parameters.slice(*wrapped_keys)
|
||||
|
||||
# This will make the wrapped hash accessible from controller and view
|
||||
request.parameters.merge! wrapped_hash
|
||||
|
|
|
@ -37,6 +37,14 @@ class ParamsWrapperTest < ActionController::TestCase
|
|||
UsersController.last_parameters = nil
|
||||
end
|
||||
|
||||
def test_filtered_parameters
|
||||
with_default_wrapper_options do
|
||||
@request.env['CONTENT_TYPE'] = 'application/json'
|
||||
post :parse, { 'username' => 'sikachu' }
|
||||
assert_equal @request.filtered_parameters, { 'controller' => 'params_wrapper_test/users', 'action' => 'parse', 'username' => 'sikachu', 'user' => { 'username' => 'sikachu' } }
|
||||
end
|
||||
end
|
||||
|
||||
def test_derived_name_from_controller
|
||||
with_default_wrapper_options do
|
||||
@request.env['CONTENT_TYPE'] = 'application/json'
|
||||
|
|
Loading…
Reference in a new issue