enforce Proxy#uri to be a URI

This commit is contained in:
technoweenie 2012-10-21 14:37:00 -06:00
parent b2eded6f1c
commit fa58f794c5

View File

@ -56,16 +56,16 @@ module Faraday
end end
end end
class RequestOptions < Options.new(:params_encoder, :oauth, :bind, class RequestOptions < Options.new(:params_encoder, :proxy, :bind,
:timeout, :open_timeout, :boundary, :timeout, :open_timeout, :boundary,
:custom, :proxy) :custom, :oauth)
def params_encoder def params_encoder
self[:params_encoder] ||= NestedParamsEncoder self[:params_encoder] ||= NestedParamsEncoder
end end
end end
class SSLOptions < Options.new(:verify, :ca_file, :ca_path, class SSLOptions < Options.new(:verify, :ca_file, :ca_path, :verify_mode,
:cert_store, :client_cert, :client_key, :verify_depth, :version) :cert_store, :client_cert, :client_key, :verify_depth, :version)
def verify? def verify?
@ -85,14 +85,11 @@ module Faraday
case value case value
when String then value = {:uri => Connection.URI(value)} when String then value = {:uri => Connection.URI(value)}
when URI then value = {:uri => value} when URI then value = {:uri => value}
when Hash, Options then value[:uri] = Connection.URI(value[:uri])
end end
super(value) super(value)
end end
def uri
@uri ||= Connection.URI(self[:uri])
end
def user def user
self[:user] ||= Utils.unescape(uri.user) self[:user] ||= Utils.unescape(uri.user)
end end