lib/toxiproxy.rb in toxiproxy-2.0.0 vs lib/toxiproxy.rb in toxiproxy-2.0.1

- old
+ new

@@ -66,10 +66,12 @@ end # Sets the toxiproxy host to use. def self.host=(host) @uri = host.is_a?(::URI) ? host : ::URI.parse(host) + reset_http_client! + @uri end # Convenience method to create a proxy. def self.create(options) self.new(options).create @@ -219,9 +221,18 @@ stream: attrs['stream'], toxicity: attrs['toxicity'], attributes: attrs['attributes'], ) } + end + + def self.reset_http_client! + if defined? @http + @http.finish() if @http && @http.started? + @http = nil + end + + @http end private def self.http_request(request)