lib/toxiproxy/toxic.rb in toxiproxy-1.0.2 vs lib/toxiproxy/toxic.rb in toxiproxy-1.0.3
- old
+ new
@@ -1,8 +1,8 @@
class Toxiproxy
class Toxic
- attr_reader :name, :type, :attributes, :stream, :proxy
+ attr_reader :name, :type, :stream, :proxy
attr_accessor :attributes, :toxicity
def initialize(attrs)
raise "Toxic type is required" unless attrs[:type]
@type = attrs[:type]
@@ -13,9 +13,10 @@
@attributes = attrs[:attributes] || {}
end
def save
request = Net::HTTP::Post.new("/proxies/#{proxy.name}/toxics")
+ request["Content-Type"] = "application/json"
request.body = as_json
response = Toxiproxy.http_request(request)
Toxiproxy.assert_response(response)