Sha256: 81b72bf3f69dc47cb6346b623697f3d4288efc9d067fd116d1b42c7d4932c8b0

Contents?: true

Size: 688 Bytes

Versions: 12

Compression:

Stored size: 688 Bytes

Contents

rad.http

# 
# Outdated, Rack does this by themself, keeping it just in case.
# 
class PrepareParams < Rad::Conveyors::Processor
  def call    
    workspace.env.must_be.defined    
    workspace.request = Rad::Http::Request.new(workspace.env)    
    workspace.path = workspace.request.path
    params = workspace.params = Rad::Conveyors::Params.new(workspace.request.params)

    if params.json?
      json_params = JSON.load params['json']
      json_params.must_be.a Hash
      json_params.keys.each do |k|
        logger.warn "RAD parameter :#{k} will be overwriden from JSON!" if params.include?(k)
      end
      params.merge! json_params
    end
    next_processor.call
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rad_core-0.2.6 lib/rad/http/processors/prepare_params.rb
rad_core-0.2.5 lib/rad/http/processors/prepare_params.rb
rad_core-0.2.4 lib/rad/http/processors/prepare_params.rb
rad_core-0.2.3 lib/rad/http/processors/prepare_params.rb
rad_core-0.2.2 lib/rad/http/processors/prepare_params.rb
rad_core-0.2.1 lib/rad/http/processors/prepare_params.rb
rad_core-0.2.0 lib/rad/http/processors/prepare_params.rb
rad_core-0.0.30 lib/rad/http/processors/prepare_params.rb
rad_core-0.0.29 lib/rad/http/processors/prepare_params.rb
rad_core-0.0.28 lib/rad/http/processors/prepare_params.rb
rad_core-0.0.27 lib/rad/http/processors/prepare_params.rb
rad_core-0.0.26 lib/rad/http/processors/prepare_params.rb