lib/flexirest/request.rb in flexirest-1.7.7 vs lib/flexirest/request.rb in flexirest-1.7.8
- old
+ new
@@ -457,10 +457,10 @@
end
base_url.gsub!(%r{//(.)}, "//#{username}:#{password}@\\1") if username && !base_url[%r{//[^/]*:[^/]*@}]
connection = Flexirest::ConnectionManager.get_connection(base_url)
end
else
- parts = @url.match(%r{^(https?://[a-z\d\.:-]+?)(/.*)}).to_a
+ parts = @url.match(%r{^(https?://[a-z\d\.:-]+?)(/.*)?$}).to_a
if (parts.empty?) # Not a full URL, so use hostname/protocol from existing base_url
uri = URI.parse(base_url)
@base_url = "#{uri.scheme}://#{uri.host}#{":#{uri.port}" if uri.port != 80 && uri.port != 443}"
@url = "#{base_url}#{@url}".gsub(@base_url, "")
base_url = @base_url