Sha256: 2d7bd622b50311aa039702a255485f5a4dc5f4c4c126993e0c750cd12147d457

Contents?: true

Size: 672 Bytes

Versions: 1

Compression:

Stored size: 672 Bytes

Contents

module Rad
  module Processors    
    class PrepareParams < Processor
      def call
        workspace.env.must_be.defined
        workspace.request = Rad::Request.new(workspace.env)
        workspace.path = workspace.request.path
        params = workspace.params = Rad::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 "Parameter :#{k} will be overwriden from JSON!" if params.include?(k)
          end
          params.merge! json_params
        end
        next_processor.call
      end
    end 
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rad_core-0.0.13 lib/rad/http/processors/prepare_params.rb