Module: Unleash::Util::Http

Defined in:
lib/unleash/util/http.rb

Class Method Summary collapse

Class Method Details

.get(uri, etag = nil, headers_override = nil) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/unleash/util/http.rb', line 7

def self.get(uri, etag = nil, headers_override = nil)
  http = http_connection(uri)

  request = Net::HTTP::Get.new(uri.request_uri, http_headers(etag, headers_override))

  http.request(request)
end

.post(uri, body) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/unleash/util/http.rb', line 15

def self.post(uri, body)
  http = http_connection(uri)

  request = Net::HTTP::Post.new(uri.request_uri, http_headers)
  request.body = body

  http.request(request)
end