Class: AgileProxy::MergePostAndGetParams
- Inherits:
-
Object
- Object
- AgileProxy::MergePostAndGetParams
- Defined in:
- lib/agile_proxy/handlers/stub_handler.rb
Overview
A rack middleware to merge post and get parameters ready for routing
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ MergePostAndGetParams
constructor
A new instance of MergePostAndGetParams.
Constructor Details
#initialize(app) ⇒ MergePostAndGetParams
Returns a new instance of MergePostAndGetParams.
124 125 126 |
# File 'lib/agile_proxy/handlers/stub_handler.rb', line 124 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
128 129 130 131 132 133 134 135 136 |
# File 'lib/agile_proxy/handlers/stub_handler.rb', line 128 def call(env) request = ActionDispatch::Request.new(env) request.params #Might seem odd, but action dispatch request is a bit naughty and adds the appropriate # bits to ENV during access to this getter when used for the first time env['action_dispatch.request.parameters'].merge!( env['action_dispatch.request.request_parameters'] ) unless request.content_length.zero? @app.call(env) end |