Class: Infrataster::Contexts::HttpContext
- Inherits:
-
BaseContext
- Object
- BaseContext
- Infrataster::Contexts::HttpContext
- Defined in:
- lib/infrataster/contexts/http_context.rb
Instance Attribute Summary
Attributes inherited from BaseContext
Instance Method Summary collapse
Methods inherited from BaseContext
Constructor Details
This class inherits a constructor from Infrataster::Contexts::BaseContext
Instance Method Details
#response ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/infrataster/contexts/http_context.rb', line 6 def response server.forward_port(resource.uri.port) do |address, port| url = "#{resource.uri.scheme}://#{address}:#{port}" conn = Faraday.new(:url => url) do |faraday| faraday.request :url_encoded faraday.response :logger, Logger faraday.adapter Faraday.default_adapter end conn.public_send(resource.method) do |req| resource.params.each_pair do |k, v| req.params[k] = v end req.headers['Host'] = resource.uri.host resource.headers.each_pair do |k, v| req.headers[k] = v end req.url resource.uri.path end end end |