lib/zabbixapi/client.rb in zabbixapi-0.5.0b3 vs lib/zabbixapi/client.rb in zabbixapi-0.5.0b4
- old
+ new
@@ -44,13 +44,13 @@
JSON.generate(message)
end
def http_request(body)
uri = URI.parse(@options[:url])
- if @proxy_uri.nil?
- http = Net::HTTP.Proxy(@proxy_host, @proxy_port, @proxy_user, @proxy_pass).new(uri.host, uri.port)
- else
+ unless @proxy_uri.nil?
http = Net::HTTP.new(uri.host, uri.port)
+ else
+ http = Net::HTTP.Proxy(@proxy_host, @proxy_port, @proxy_user, @proxy_pass).new(uri.host, uri.port)
end
request = Net::HTTP::Post.new(uri.request_uri)
request.add_field('Content-Type', 'application/json-rpc')
request.body = body
response = http.request(request)