rack-remove-param 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rack/remove-param.rb +9 -6
- metadata +1 -1
data/lib/rack/remove-param.rb
CHANGED
@@ -13,7 +13,7 @@ module Rack
|
|
13
13
|
@request = Rack::Request.new(env)
|
14
14
|
|
15
15
|
if @request.post?
|
16
|
-
|
16
|
+
delete_params(@request.params)
|
17
17
|
env["rack.request.form_hash"] = @request.params
|
18
18
|
env["rack.request.form_vars"] = Rack::Utils.build_query(@request.params)
|
19
19
|
end
|
@@ -28,12 +28,15 @@ module Rack
|
|
28
28
|
@params_to_filter = params.is_a?(String) ? Array.new(1, params) : Array.new(params)
|
29
29
|
end
|
30
30
|
|
31
|
-
def
|
32
|
-
|
33
|
-
|
34
|
-
hash.delete(param)
|
35
|
-
hash.each{|k, value| delete_param(value, param) if value.is_a?(Hash) }
|
31
|
+
def delete_params(hash)
|
32
|
+
@params_to_filter.each do |param|
|
33
|
+
delete_param(hash, param)
|
36
34
|
end
|
37
35
|
end
|
36
|
+
|
37
|
+
def delete_param(hash, param)
|
38
|
+
hash.delete(param)
|
39
|
+
hash.each{|k, value| delete_param(value, param) if value.is_a?(Hash) }
|
40
|
+
end
|
38
41
|
end
|
39
42
|
end
|