lib/unleash/client.rb in unleash-0.1.3 vs lib/unleash/client.rb in unleash-0.1.4
- old
+ new
@@ -29,11 +29,11 @@
end
def is_enabled?(feature, context = nil, default_value = false)
Unleash.logger.debug "Unleash::Client.is_enabled? feature: #{feature} with context #{context}"
- toggle_as_hash = Unleash.toggles.select{ |toggle| toggle['name'] == feature }.first
+ toggle_as_hash = Unleash.toggles.select{ |toggle| toggle['name'] == feature }.first if Unleash.toggles
if toggle_as_hash.nil?
Unleash.logger.debug "Unleash::Client.is_enabled? feature: #{feature} not found"
return default_value
end
@@ -63,10 +63,10 @@
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if uri.scheme == 'https'
http.open_timeout = Unleash.configuration.timeout # in seconds
http.read_timeout = Unleash.configuration.timeout # in seconds
- headers = (Unleash.configuration.custom_http_headers || {}).dup
+ headers = (Unleash.configuration.get_http_headers || {}).dup
headers['Content-Type'] = 'application/json'
request = Net::HTTP::Post.new(uri.request_uri, headers)
request.body = info.to_json