lib/faraday/connection.rb in faraday-0.7.2 vs lib/faraday/connection.rb in faraday-0.7.3
- old
+ new
@@ -215,10 +215,12 @@
# conn.build_url("nigiri", :page => 2) # => https://sushi.com/api/nigiri?token=abc&page=2
#
def build_url(url, extra_params = nil)
uri = URI.parse(url.to_s)
if @path_prefix && uri.path !~ /^\//
- uri.path = "#{@path_prefix.size > 1 ? @path_prefix : nil}/#{uri.path}"
+ new_path = @path_prefix.size > 1 ? @path_prefix.dup : ''
+ new_path << "/#{uri.path}" unless uri.path.empty?
+ uri.path = new_path
end
uri.host ||= @host
uri.port ||= @port
uri.scheme ||= @scheme