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

- old
+ new

@@ -23,17 +23,18 @@ 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 - request = Net::HTTP.new(uri.hostname, uri.port) - request.use_ssl = true - response = request.start do |http| - http.request post - end + 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 end end end end end