Sha256: 4e9031cc8af252c68db6e3ee2fa1c3e1429c170fa9e37025d0f712c54e98abcc

Contents?: true

Size: 684 Bytes

Versions: 12

Compression:

Stored size: 684 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.0.25 lib/rad/http/processors/prepare_params.rb
rad_core-0.0.24 lib/rad/http/processors/prepare_params.rb
rad_core-0.0.23 lib/rad/http/processors/prepare_params.rb
rad_core-0.0.22 lib/rad/http/processors/prepare_params.rb
rad_core-0.0.21 lib/rad/http/processors/prepare_params.rb
rad_core-0.0.20 lib/rad/http/processors/prepare_params.rb
rad_core-0.0.19 lib/rad/http/processors/prepare_params.rb
rad_core-0.0.18 lib/rad/http/processors/prepare_params.rb
rad_core-0.0.17 lib/rad/http/processors/prepare_params.rb
rad_core-0.0.16 lib/rad/http/processors/prepare_params.rb
rad_core-0.0.15 lib/rad/http/processors/prepare_params.rb
rad_core-0.0.14 lib/rad/http/processors/prepare_params.rb