Class: Locomotive::API::Middlewares::ParamsDecoderMiddleware

Inherits:
Object
  • Object
show all
Defined in:
app/api/locomotive/api/middlewares/params_decoder_middleware.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ ParamsDecoderMiddleware

Returns a new instance of ParamsDecoderMiddleware.



12
13
14
# File 'app/api/locomotive/api/middlewares/params_decoder_middleware.rb', line 12

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



16
17
18
19
20
# File 'app/api/locomotive/api/middlewares/params_decoder_middleware.rb', line 16

def call(env)
  request = Rack::Request.new(env)
  decode(request.params).each_pair { |k, v| update_params request, k, v }
  @app.call(env)
end