Class: ActionDispatch::ParamsParser

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

Defined Under Namespace

Classes: ParseError

Constant Summary collapse

DEFAULT_PARSERS =
{ Mime::JSON => :json }

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of ParamsParser.



18
19
20
# File 'lib/action_dispatch/middleware/params_parser.rb', line 18

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

Instance Method Details

#call(env) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/action_dispatch/middleware/params_parser.rb', line 22

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

  @app.call(env)
end