30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/unit/utils/http_helper.rb', line 30
def self.make_request(net_http, url, , body: nil, params: nil, response_type: nil)
uri = params.nil? ? URI(url) : URI("#{url}?#{encode(params)}")
host = uri.host.to_s
port = uri.port
options = { use_ssl: uri.scheme == "https" }
Net::HTTP.start(host, port, options) do |http|
request = net_http.new uri,
request.body = body unless body.nil?
response = http.request request
response.body = response_check(response, response_type)
response
end
end
|