Skip to content

Commit

Permalink
keep a singleton filter around that we can use when no filter is set
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Oct 19, 2012
1 parent 79e91cc commit 481f30e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions actionpack/lib/action_dispatch/http/filter_parameters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ module Http
module FilterParameters
@@parameter_filter_for = {}

NULL_FILTER = ParameterFilter.new # :nodoc:

def initialize(env)
super
@filtered_parameters = nil
Expand All @@ -47,15 +49,17 @@ def filtered_path
protected

def parameter_filter
parameter_filter_for(@env["action_dispatch.parameter_filter"])
parameter_filter_for @env.fetch("action_dispatch.parameter_filter") {
return NULL_FILTER
}
end

def env_filter
parameter_filter_for(Array(@env["action_dispatch.parameter_filter"]) + [/RAW_POST_DATA/, "rack.request.form_vars"])
end

def parameter_filter_for(filters)
@@parameter_filter_for[filters] ||= ParameterFilter.new(filters || [])
@@parameter_filter_for[filters] ||= ParameterFilter.new(filters)
end

KV_RE = '[^&;=]+'
Expand Down

0 comments on commit 481f30e

Please sign in to comment.