Skip to content

Commit

Permalink
Request#filter_parameters and filter_env
Browse files Browse the repository at this point in the history
  • Loading branch information
josh committed Jan 20, 2010
1 parent f7d94cd commit 87bcf1a
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions actionpack/lib/action_dispatch/http/parameters.rb
Expand Up @@ -29,9 +29,31 @@ def symbolized_path_parameters
def path_parameters
@env["action_dispatch.request.path_parameters"] ||= {}
end

private

def filter_parameters
# TODO: Remove dependency on controller
if controller = @env['action_controller.instance']
controller.send(:filter_parameters, params)
else
params
end
end

def filter_env
if controller = @env['action_controller.instance']
@env.map do |key, value|
if (key =~ /RAW_POST_DATA/i)
'[FILTERED]'
else
controller.send(:filter_parameters, {key => value}).values[0]
end
end
else
env
end
end

private
# Convert nested Hashs to HashWithIndifferentAccess
def normalize_parameters(value)
case value
Expand Down

3 comments on commit 87bcf1a

@mikel
Copy link
Member

@mikel mikel commented on 87bcf1a Jan 21, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests would probably be a good idea for something like this...

@josh
Copy link
Contributor Author

@josh josh commented on 87bcf1a Jan 21, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mikel
Copy link
Member

@mikel mikel commented on 87bcf1a Jan 22, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, ok :)

Please sign in to comment.