Class: Rack::RemoveParam

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/remove-param.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, params_to_filter) ⇒ RemoveParam

Returns a new instance of RemoveParam.



3
4
5
6
# File 'lib/rack/remove-param.rb', line 3

def initialize(app, params_to_filter)
  process_params(params_to_filter)
  @app = app
end

Instance Method Details

#_call(env) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/rack/remove-param.rb', line 12

def _call(env)
  @request = Rack::Request.new(env)

  if @request.post?
    delete_params(@request.params)
    env["rack.request.form_hash"] = @request.params
    env["rack.request.form_vars"] = Rack::Utils.build_query(@request.params)
  end

  @status, @headers, @body = @app.call(env)
  [@status, @headers, @body]
end

#call(env) ⇒ Object



8
9
10
# File 'lib/rack/remove-param.rb', line 8

def call(env)
  dup._call(env)
end