lib/elasticsearch/transport/transport/connections/connection.rb in elasticsearch-transport-7.9.0 vs lib/elasticsearch/transport/transport/connections/connection.rb in elasticsearch-transport-7.10.0.pre
- old
+ new
@@ -17,11 +17,10 @@
module Elasticsearch
module Transport
module Transport
module Connections
-
# Wraps the connection information and logic.
#
# The Connection instance wraps the host information (hostname, port, attributes, etc),
# as well as the "session" (a transport client object, such as a {HTTP::Faraday} instance).
#
@@ -52,15 +51,17 @@
# Returns the complete endpoint URL with host, port, path and serialized parameters.
#
# @return [String]
#
- def full_url(path, params={})
+ def full_url(path, params = {})
url = "#{host[:protocol]}://"
url += "#{CGI.escape(host[:user])}:#{CGI.escape(host[:password])}@" if host[:user]
url += "#{host[:host]}:#{host[:port]}"
url += "#{host[:path]}" if host[:path]
- url += "/#{full_path(path, params)}"
+ full_path = full_path(path, params)
+ url += '/' unless full_path.match?(/^\//)
+ url += full_path
end
# Returns the complete endpoint path with serialized parameters.
#
# @return [String]