Skip to content

Commit 467f473

Browse files
committed
[CLIENT] Make code more succinct for supporting host with path and no port
1 parent 178a343 commit 467f473

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

elasticsearch-transport/lib/elasticsearch/transport/client.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,7 @@ def __parse_host(host)
197197
uri = URI.parse(host)
198198

199199
# Handle when port is not specified
200-
if uri.port == uri.default_port
201-
port = nil
202-
else
203-
port = uri.port
204-
end
200+
port = uri.port unless uri.port == uri.default_port
205201

206202
{ :scheme => uri.scheme,
207203
:user => uri.user,

elasticsearch-transport/spec/elasticsearch/transport/client_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@
327327
end
328328
end
329329

330-
context 'when there is one host with a scheme, protocol and no port' do
330+
context 'when there is one host with a scheme, protocol, path, and no port' do
331331

332332
let(:host) do
333333
['http://myhost/foo/bar']

0 commit comments

Comments
 (0)