Skip to content

Commit

Permalink
diagnostic events should respect HTTPS_PROXY (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
bwoskow-ld authored Aug 6, 2021
1 parent ea70f09 commit 0de2cab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/ldclient-rb/impl/diagnostic_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def self.make_config_data(config)
streamingDisabled: !config.stream?,
userKeysCapacity: config.user_keys_capacity,
userKeysFlushIntervalMillis: self.seconds_to_millis(config.user_keys_flush_interval),
usingProxy: ENV.has_key?('http_proxy') || ENV.has_key?('https_proxy') || ENV.has_key?('HTTP_PROXY'),
usingProxy: ENV.has_key?('http_proxy') || ENV.has_key?('https_proxy') || ENV.has_key?('HTTP_PROXY') || ENV.has_key?('HTTPS_PROXY'),
usingRelayDaemon: config.use_ldd?,
}
ret
Expand Down
16 changes: 9 additions & 7 deletions spec/diagnostic_events_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,15 @@ def expected_default_config
end
end

it "detects proxy" do
begin
ENV["http_proxy"] = 'http://my-proxy'
event = default_acc.create_init_event(Config.new)
expect(event[:configuration][:usingProxy]).to be true
ensure
ENV["http_proxy"] = nil
['http_proxy', 'https_proxy', 'HTTP_PROXY', 'HTTPS_PROXY'].each do |name|
it "detects proxy #{name}" do
begin
ENV["#{name}"] = 'http://my-proxy'
event = default_acc.create_init_event(Config.new)
expect(event[:configuration][:usingProxy]).to be true
ensure
ENV["#{name}"] = nil
end
end
end

Expand Down

0 comments on commit 0de2cab

Please sign in to comment.