Module: Jackal::Cfn::Utils::Http

Included in:
Event, Resource
Defined in:
lib/jackal-cfn/utils/http.rb

Overview

Helper module for HTTP interactions

Instance Method Summary collapse

Instance Method Details

#response_endpoint(host, scheme) ⇒ Patron::Session Also known as: http_endpoint

Provide remote endpoint session for sending response

Parameters:

  • host (String)

    end point host

  • scheme (String)

    end point scheme

Returns:

  • (Patron::Session)


15
16
17
18
19
20
21
22
# File 'lib/jackal-cfn/utils/http.rb', line 15

def response_endpoint(host, scheme)
  session = Patron::Session.new
  session.timeout = config.fetch(:response_timeout, 20)
  session.connect_timeout = config.fetch(:connection_timeout, 10)
  session.base_url = "#{scheme}://#{host}"
  session.headers['User-Agent'] = "JackalCfn/#{Jackal::Cfn::VERSION.version}"
  session
end