Skip to content

Commit 755a679

Browse files
estolfopicandocodigo
authored andcommitted
Only remove the last arg if it has an endpoint key
1 parent f5e3845 commit 755a679

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

elasticsearch/lib/elasticsearch.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def method_missing(name, *args, &block)
6262
# method, path, params, body, headers, opts
6363
# The last arg is opts, which shouldn't be sent when `perform_request` is called
6464
# directly.
65-
args.pop
65+
args.pop if args[-1][:endpoint]
6666
if (opaque_id = args[2]&.delete(:opaque_id))
6767
headers = args[4] || {}
6868
opaque_id = @opaque_id_prefix ? "#{@opaque_id_prefix}#{opaque_id}" : opaque_id
@@ -74,9 +74,6 @@ def method_missing(name, *args, &block)
7474
@transport.perform_request(*args, &block)
7575
end
7676
else
77-
# The last arg is opts, which shouldn't be sent when `perform_request` is called
78-
# directly.
79-
args.pop
8077
@transport.send(name, *args, &block)
8178
end
8279
end

0 commit comments

Comments
 (0)