@@ -37,8 +37,9 @@ class Client
3737 #
3838 # @param [Hash] arguments - initializer arguments
3939 # @option arguments [String] :cloud_id - The Cloud ID to connect to Elastic Cloud
40- # @option arguments [String, Hash] :api_key Use API Key Authentication, either the base64 encoding of `id` and `api_key`
41- # joined by a colon as a String, or a hash with the `id` and `api_key` values.
40+ # @option arguments [String, Hash] :api_key Use API Key Authentication, either the base64 encoding of `id` and
41+ # `api_key` joined by a colon as a String, or a hash with the `id` and
42+ # `api_key` values.
4243 # @option arguments [String] :opaque_id_prefix set a prefix for X-Opaque-Id when initializing the client.
4344 # This will be prepended to the id you set before each request
4445 # if you're using X-Opaque-Id
@@ -65,10 +66,10 @@ def method_missing(name, *args, &block)
6566 opaque_id = @opaque_id_prefix ? "#{ @opaque_id_prefix } #{ opaque_id } " : opaque_id
6667 args [ 4 ] = headers . merge ( 'X-Opaque-Id' => opaque_id )
6768 end
68- unless @verified
69- verify_elasticsearch ( *args , &block )
70- else
69+ if @verified
7170 @transport . perform_request ( *args , &block )
71+ else
72+ verify_elasticsearch ( *args , &block )
7273 end
7374 else
7475 @transport . send ( name , *args , &block )
@@ -101,6 +102,7 @@ def verify_elasticsearch(*args, &block)
101102 raise e
102103 end
103104 raise Elasticsearch ::UnsupportedProductError unless response . headers [ 'x-elastic-product' ] == 'Elasticsearch'
105+
104106 @verified = true
105107 response
106108 end
@@ -175,7 +177,7 @@ def set_user_agent!(arguments)
175177 end
176178 arguments [ :transport_options ] ||= { }
177179 arguments [ :transport_options ] [ :headers ] ||= { }
178- arguments [ :transport_options ] [ :headers ] . merge! ( { user_agent : user_agent . join ( '; ' ) } )
180+ arguments [ :transport_options ] [ :headers ] . merge! ( { user_agent : user_agent . join ( '; ' ) } )
179181 end
180182 end
181183
0 commit comments