lib/nadir/transport/http_async.rb in nadir-1.0.2 vs lib/nadir/transport/http_async.rb in nadir-1.1.0

- old
+ new

@@ -23,18 +23,17 @@ end def deliver(params) self.class.thread_pool.post do uri = URI("#{@api_url}/faults") + post = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json') + post.body = {fault: params, api_key: @api_key}.to_json - http = Net::HTTP.new(uri.host, uri.port) - - http.use_ssl = true if uri.class == URI::HTTPS - - request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json') - request.body = {fault: params, api_key: @api_key}.to_json - - http.request request + request = Net::HTTP.new(uri.hostname, uri.port) + request.use_ssl = true + response = request.start do |http| + http.request post + end end end end end end