Class: ActionDispatch::ParamsParser

Inherits:
Object
  • Object
show all
Defined in:
lib/action_dispatch/middleware/params_parser.rb

Constant Summary collapse

DEFAULT_PARSERS =
{
  Mime::XML => :xml_simple,
  Mime::JSON => :json
}

Instance Method Summary collapse

Constructor Details

#initialize(app, parsers = {}) ⇒ ParamsParser

Returns a new instance of ParamsParser.



12
13
14
# File 'lib/action_dispatch/middleware/params_parser.rb', line 12

def initialize(app, parsers = {})
  @app, @parsers = app, DEFAULT_PARSERS.merge(parsers)
end

Instance Method Details

#call(env) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/action_dispatch/middleware/params_parser.rb', line 16

def call(env)
  if params = parse_formatted_parameters(env)
    env["action_dispatch.request.request_parameters"] = params
  end

  @app.call(env)
end