lib/faraday/connection.rb in faraday-1.0.1 vs lib/faraday/connection.rb in faraday-1.1.0
- old
+ new
@@ -427,11 +427,11 @@
# @param value [String]
#
# @return [String] the new path prefix
def path_prefix=(value)
url_prefix.path = if value
- value = '/' + value unless value[0, 1] == '/'
+ value = "/#{value}" unless value[0, 1] == '/'
value
end
end
# Takes a relative url for a request and combines it with the defaults
@@ -518,11 +518,11 @@
def build_exclusive_url(url = nil, params = nil, params_encoder = nil)
url = nil if url.respond_to?(:empty?) && url.empty?
base = url_prefix
if url && base.path && base.path !~ %r{/$}
base = base.dup
- base.path = base.path + '/' # ensure trailing slash
+ base.path = "#{base.path}/" # ensure trailing slash
end
uri = url ? base + url : base
if params
uri.query = params.to_query(params_encoder || options.params_encoder)
end
@@ -591,10 +591,10 @@
def find_default_proxy
uri = ENV['http_proxy']
return unless uri && !uri.empty?
- uri = 'http://' + uri if uri !~ /^http/i
+ uri = "http://#{uri}" unless uri.match?(/^http/i)
uri
end
def proxy_for_request(url)
return proxy if @manual_proxy