Class: XProxy::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/xproxy/application.rb

Instance Method Summary collapse

Constructor Details

#initialize(host, headers) ⇒ Application

Returns a new instance of Application.



6
7
8
# File 'lib/xproxy/application.rb', line 6

def initialize(host, headers)
  @host, @headers = host, headers
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/xproxy/application.rb', line 10

def call(env)      
  host, headers = @host, @headers
  
  app = Rack::Builder.new do
    use Rack::Header, headers        
    run Rack::Proxy.new(host)
  end
  
  app.call(env)
end