diff --git a/lib/faraday/options.rb b/lib/faraday/options.rb index 52ef1989..904367bb 100644 --- a/lib/faraday/options.rb +++ b/lib/faraday/options.rb @@ -48,8 +48,9 @@ module Faraday # Public def fetch(key, default = nil) - send(key) || send("#{key}=", default || - (block_given? ? Proc.new.call : nil)) + return send(key) if keys.include?(key) + + send("#{key}=", default || (block_given? ? Proc.new.call : nil)) end # Public diff --git a/test/options_test.rb b/test/options_test.rb index 97a97108..5ea800f2 100644 --- a/test/options_test.rb +++ b/test/options_test.rb @@ -164,4 +164,10 @@ class OptionsTest < Faraday::TestCase e["custom"] = :boom assert_equal :boom, e["custom"] end + + def test_env_fetch_ignores_false + ssl = Faraday::SSLOptions.new + ssl.verify = false + assert !ssl.fetch(:verify, true) + end end