class Faraday::Connection
def build_exclusive_url(url = nil, params = nil, params_encoder = nil)
-
(URI)
-
Parameters:
-
params
(Faraday::Utils::ParamsHash
) -- A Faraday::Utils::ParamsHash to -
url
(String, URI, nil
) --
def build_exclusive_url(url = nil, params = nil, params_encoder = nil) url = nil if url.respond_to?(:empty?) && url.empty? base = url_prefix.dup if url && !base.path.end_with?('/') base.path = "#{base.path}/" # ensure trailing slash end # Ensure relative url will be parsed correctly (such as `service:search` ) url = "./#{url}" if url.respond_to?(:start_with?) && !url.start_with?('http://', 'https://', '/', './', '../') uri = url ? base + url : base if params uri.query = params.to_query(params_encoder || options.params_encoder) end uri.query = nil if uri.query && uri.query.empty? uri end