Skip to content

Commit 25d18c6

Browse files
estolfopicandocodigo
authored andcommitted
Remove opts from args when calling perform_request directly
1 parent 0828c67 commit 25d18c6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

elasticsearch/lib/elasticsearch.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ def method_missing(name, *args, &block)
5959
super
6060
elsif name == :perform_request
6161
# The signature for perform_request is:
62-
# method, path, params, body, headers
62+
# method, path, params, body, headers, opts
63+
# The last arg is opts, which shouldn't be sent when `perform_request` is called
64+
# directly.
65+
args.pop
6366
if (opaque_id = args[2]&.delete(:opaque_id))
6467
headers = args[4] || {}
6568
opaque_id = @opaque_id_prefix ? "#{@opaque_id_prefix}#{opaque_id}" : opaque_id
@@ -71,6 +74,9 @@ def method_missing(name, *args, &block)
7174
@transport.perform_request(*args, &block)
7275
end
7376
else
77+
# The last arg is opts, which shouldn't be sent when `perform_request` is called
78+
# directly.
79+
args.pop
7480
@transport.send(name, *args, &block)
7581
end
7682
end

0 commit comments

Comments
 (0)