Class: PrepareParams

Inherits:
Rad::Conveyors::Processor show all
Defined in:
lib/rad/http/processors/prepare_params.rb

Overview

Outdated, Rack does this by themself, keeping it just in case.

Instance Attribute Summary

Attributes inherited from Rad::Conveyors::Processor

#next_processor

Instance Method Summary collapse

Methods inherited from Rad::Conveyors::Processor

#initialize, inspect

Constructor Details

This class inherits a constructor from Rad::Conveyors::Processor

Instance Method Details

#callObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rad/http/processors/prepare_params.rb', line 7

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