Class: Relax2::RequestContext::ActualHttpRequestHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/relax2/request_context.rb

Instance Method Summary collapse

Constructor Details

#initialize(base_url) ⇒ ActualHttpRequestHandler

Returns a new instance of ActualHttpRequestHandler.



33
34
35
# File 'lib/relax2/request_context.rb', line 33

def initialize(base_url)
  @base_url = base_url
end

Instance Method Details

#call(request) ⇒ Relas2::Response

Parameters:

  • (Relax::Request)

Returns:

  • (Relas2::Response)


39
40
41
42
43
44
45
# File 'lib/relax2/request_context.rb', line 39

def call(request)
  net_http_request = net_http_request_from(request)
  net_http_response = start_net_http_session do |http|
    http.request(net_http_request)
  end
  response_from(net_http_response)
end