|
|
|
@ -156,19 +156,16 @@ class EcloudController < ApplicationController
|
|
|
|
|
private
|
|
|
|
|
def get(url)
|
|
|
|
|
uri = URI(url)
|
|
|
|
|
res = Net::HTTP.start(uri.host, uri.port, use_ssl: url.start_with?('https')) do |http|
|
|
|
|
|
|
|
|
|
|
## TODO
|
|
|
|
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
|
|
|
|
|
|
|
|
|
req = Net::HTTP::Get.new(uri)
|
|
|
|
|
#req['Content-Type'] = 'application/json'
|
|
|
|
|
# The body needs to be a JSON string, use whatever you know to parse Hash to JSON
|
|
|
|
|
#req.body = {a: 1}.to_json
|
|
|
|
|
http.request(req)
|
|
|
|
|
end
|
|
|
|
|
http = Net::HTTP.new(uri.host, uri.port)
|
|
|
|
|
http.use_ssl = url.start_with?('https')
|
|
|
|
|
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
|
|
|
|
request = Net::HTTP::Get.new(uri.request_uri)
|
|
|
|
|
request['Content-Type'] = 'application/json'
|
|
|
|
|
request['Accept'] = 'application/json'
|
|
|
|
|
response = http.request(request)
|
|
|
|
|
|
|
|
|
|
res.body
|
|
|
|
|
response.body
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def post(url)
|
|
|
|
|