Module: Misty::HTTP::NetHTTP

Included in:
Auth::Token, Openstack::ServicePack
Defined in:
lib/misty/http/net_http.rb

Overview

This class wraps net/http request routine.

Class Method Summary collapse

Class Method Details

.http_request(uri, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/misty/http/net_http.rb', line 5

def self.http_request(uri, options = {})
  http_options = {}
  if uri.scheme == 'https'
    http_options[:use_ssl] = true
    if options.fetch(:ssl_verify_mode, true) == false
      http_options[:verify_mode] = OpenSSL::SSL::VERIFY_NONE
    end
  end

  Net::HTTP.start(uri.host, uri.port, :ENV, http_options) do |connection|
    yield(connection)
  end
end