Sha256: 40dce50c1e90c63829023efe9c2f057340e72258e5b051ed0f3710637a052e68

Contents?: true

Size: 917 Bytes

Versions: 1

Compression:

Stored size: 917 Bytes

Contents

module Rad
  module HTTPAdapter
    class << self    
      inject conveyors: :conveyors, config: :config
      
      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
      # synchronize_method :call
      
      # def mock_call env = {}, workspace = {}, &block
      #   env['PATH_INFO'] ||= '/'
      #   env['rack.input'] ||= StringIO.new        
      #   
      #   call env, workspace, &block
      # end
      
      def mock_environment
        {
          'rack.url_scheme' => 'http',
          'PATH_INFO' => '/',
          'rack.input' => StringIO.new
        }
      end
    end        
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rad_core-0.0.13 lib/rad/http/http_adapter.rb