Module: Rad::HTTPAdapter

Defined in:
lib/rad/http/http_adapter.rb

Class Method Summary collapse

Class Method Details

.call(env, workspace = {}, &block) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/rad/http/http_adapter.rb', line 6

def call env, workspace = {}, &block
  # result, opt = nil, opt.to_openobject
  workspace = conveyors.web.call(
    {env: env, response: Rad::Response.new}.merge(workspace),
    &block
  )
  
  response = workspace.response.must_be.defined
  result = response.finish
          
  result
end

.mock_environmentObject

def mock_call env = {}, workspace = {}, &block

env['PATH_INFO'] ||= '/'
env['rack.input'] ||= StringIO.new        

call env, workspace, &block

end



27
28
29
30
31
32
33
# File 'lib/rad/http/http_adapter.rb', line 27

def mock_environment
  {
    'rack.url_scheme' => 'http',
    'PATH_INFO' => '/',
    'rack.input' => StringIO.new
  }
end