mirror of
https://github.com/lostisland/faraday.git
synced 2025-10-10 00:03:09 -04:00
Options#fetch should not return the default for false or nil values.
This commit is contained in:
parent
212278c339
commit
7d0defae6e
@ -48,8 +48,9 @@ module Faraday
|
|||||||
|
|
||||||
# Public
|
# Public
|
||||||
def fetch(key, default = nil)
|
def fetch(key, default = nil)
|
||||||
send(key) || send("#{key}=", default ||
|
return send(key) if keys.include?(key)
|
||||||
(block_given? ? Proc.new.call : nil))
|
|
||||||
|
send("#{key}=", default || (block_given? ? Proc.new.call : nil))
|
||||||
end
|
end
|
||||||
|
|
||||||
# Public
|
# Public
|
||||||
|
@ -164,4 +164,10 @@ class OptionsTest < Faraday::TestCase
|
|||||||
e["custom"] = :boom
|
e["custom"] = :boom
|
||||||
assert_equal :boom, e["custom"]
|
assert_equal :boom, e["custom"]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_env_fetch_ignores_false
|
||||||
|
ssl = Faraday::SSLOptions.new
|
||||||
|
ssl.verify = false
|
||||||
|
assert !ssl.fetch(:verify, true)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user