elasticsearch-transport 6.8.2 → 6.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c036b32f60221fef3a8c617ddc30a55c50c916b4f3c235fe34f91917060c9ae4
4
- data.tar.gz: 18d4582f2c6479fe2af5bf10a6f6cc97d6083172274be5de85d82a47f62b1a04
3
+ metadata.gz: 84ce4d26d5dd03b5bc17d89e4ce0a873b5d57083f07cf54cf78552d7e88ff61f
4
+ data.tar.gz: 69b164ec36cd3cb2ee3355c0806a0109e21a69ca605a9f87b020f9d8476e5096
5
5
  SHA512:
6
- metadata.gz: a06a56942b78b094e562ef1fa4d6adfd9433a823aeb3e21e06296574c39bcb5c228b52a009fe3a375a8682a1d0e9c9d370ff74a5a84dce4d2800170ede4e3d5c
7
- data.tar.gz: 8646819dd552fae0bbba12d03e0a2ed1c996f2d0493a0ad65c4f07bd5e2ae763d8067aefc66c8d52963def632d1a552c7271744233ba12a5b43945d281800d1c
6
+ metadata.gz: e6a9fb8c521ffedd0faf79006e477e4360a2af6df876cee41ddd87278ddf06de34a69e9ccbdad0d83629a0cf1c52d0eefbf4facdb38a591a219c156a5d7d3fdf
7
+ data.tar.gz: 2d729907c495a2946b68a193262b14261534d6811b2ea5517248977758ed869c3c2803284ff69bc9b9f5a863a9440a9f675f53287f136e5813677b95b1d106c8
data/README.md CHANGED
@@ -28,16 +28,16 @@ Features overview:
28
28
  * Node reloading (based on cluster state) on errors or on demand
29
29
 
30
30
  For optimal performance, use a HTTP library which supports persistent ("keep-alive") connections,
31
- such as [patron](https://github.com/toland/patron).
32
- Just require the library (`require 'patron'`) in your code,
33
- and it will be automatically used.
31
+ such as [patron](https://github.com/toland/patron) or [Typhoeus](https://github.com/typhoeus/typhoeus).
32
+ Just require the library (`require 'patron'`) in your code, and it will be automatically used.
34
33
 
35
34
  Currently these libraries will be automatically detected and used:
36
35
  - [Patron](https://github.com/toland/patron)
36
+ - [Typhoeus](https://github.com/typhoeus/typhoeus)
37
37
  - [HTTPClient](https://rubygems.org/gems/httpclient)
38
38
  - [Net::HTTP::Persistent](https://rubygems.org/gems/net-http-persistent)
39
39
 
40
- **Note on [Typhoeus](https://github.com/typhoeus/typhoeus)**: Typhoeus is compatible and will be automatically detected too. However, the latest release (v1.3.1 at the moment of writing this) is not compatible with Faraday 1.0. [It still uses the deprecated `Faraday::Error` namespace](https://github.com/typhoeus/typhoeus/blob/v1.3.1/lib/typhoeus/adapters/faraday.rb#L100). If you want to use it with this gem, we suggest getting `master` from GitHub, since this has been fixed for v1.4.0. We'll update this if/when v1.4.0 is released.a
40
+ **Note on [Typhoeus](https://github.com/typhoeus/typhoeus)**: You need to use v1.4.0 or up since older versions are not compatible with Faraday 1.0.
41
41
 
42
42
  For detailed information, see example configurations [below](#transport-implementations).
43
43
 
@@ -41,13 +41,14 @@ Gem::Specification.new do |s|
41
41
  # Gems for testing integrations
42
42
  s.add_development_dependency 'cane'
43
43
  s.add_development_dependency 'hashie'
44
+ s.add_development_dependency 'httpclient'
44
45
  s.add_development_dependency 'manticore', '~> 0.5.2' if defined? JRUBY_VERSION
45
46
  s.add_development_dependency 'minitest', '~> 4.0'
46
47
  s.add_development_dependency 'net-http-persistent'
47
48
  s.add_development_dependency 'simplecov', '~> 0.17', '< 0.18'
48
49
  s.add_development_dependency 'simplecov-rcov'
49
50
  s.add_development_dependency 'test-unit', '~> 2'
50
- s.add_development_dependency 'typhoeus', '~> 0.6'
51
+ s.add_development_dependency 'typhoeus', '~> 1.4'
51
52
  unless defined?(JRUBY_VERSION) || defined?(Rubinius)
52
53
  s.add_development_dependency 'curb'
53
54
  s.add_development_dependency 'patron'
@@ -92,13 +92,16 @@ module Elasticsearch
92
92
  # @option api_key [String, Hash] :api_key Use API Key Authentication, either the base64 encoding of `id` and `api_key`
93
93
  # joined by a colon as a String, or a hash with the `id` and `api_key` values.
94
94
  # @option opaque_id_prefix [String] :opaque_id_prefix set a prefix for X-Opaque-Id when initializing the client. This
95
- # will be prepended to the id you set before each request if you're using X-Opaque-Id
95
+ # will be prepended to the id you set before each request if
96
+ # you're using X-Opaque-Id
97
+ # @option enable_meta_header [Boolean] :enable_meta_header Enable sending the meta data header to Cloud.
98
+ # (Default: true)
96
99
  #
97
100
  # @yield [faraday] Access and configure the `Faraday::Connection` instance directly with a block
98
101
  #
99
- def initialize(arguments={}, &block)
100
- @options = arguments
101
- @arguments = arguments
102
+ def initialize(arguments = {}, &block)
103
+ @options = arguments.each_with_object({}){ |(k,v), args| args[k.to_sym] = v }
104
+ @arguments = @options
102
105
  @arguments[:logger] ||= @arguments[:log] ? DEFAULT_LOGGER.call() : nil
103
106
  @arguments[:tracer] ||= @arguments[:trace] ? DEFAULT_TRACER.call() : nil
104
107
  @arguments[:reload_connections] ||= false
@@ -107,6 +110,7 @@ module Elasticsearch
107
110
  @arguments[:randomize_hosts] ||= false
108
111
  @arguments[:transport_options] ||= {}
109
112
  @arguments[:http] ||= {}
113
+ @arguments[:enable_meta_header] = arguments.fetch(:enable_meta_header) { true }
110
114
  @options[:http] ||= {}
111
115
 
112
116
  set_api_key if (@api_key = @arguments[:api_key])
@@ -135,15 +139,18 @@ module Elasticsearch
135
139
  if @arguments[:transport]
136
140
  @transport = @arguments[:transport]
137
141
  else
138
- transport_class = @arguments[:transport_class] || DEFAULT_TRANSPORT_CLASS
139
- if transport_class == Transport::HTTP::Faraday
140
- @transport = transport_class.new(hosts: @seeds, options: @arguments) do |faraday|
141
- faraday.adapter(@arguments[:adapter] || __auto_detect_adapter)
142
- block&.call faraday
143
- end
144
- else
145
- @transport = transport_class.new(hosts: @seeds, options: @arguments)
146
- end
142
+ @transport_class = @arguments[:transport_class] || DEFAULT_TRANSPORT_CLASS
143
+ @transport = if @transport_class == Transport::HTTP::Faraday
144
+ @arguments[:adapter] ||= __auto_detect_adapter
145
+ set_meta_header
146
+ @transport_class.new(hosts: @seeds, options: @arguments) do |faraday|
147
+ faraday.adapter(@arguments[:adapter])
148
+ block&.call faraday
149
+ end
150
+ else
151
+ set_meta_header
152
+ @transport_class.new(hosts: @seeds, options: @arguments)
153
+ end
147
154
  end
148
155
  end
149
156
 
@@ -163,13 +170,87 @@ module Elasticsearch
163
170
 
164
171
  def set_api_key
165
172
  @api_key = __encode(@api_key) if @api_key.is_a? Hash
173
+ add_header('Authorization' => "ApiKey #{@api_key}")
174
+ @arguments.delete(:user)
175
+ @arguments.delete(:password)
176
+ end
177
+
178
+ def add_header(header)
166
179
  headers = @arguments[:transport_options]&.[](:headers) || {}
167
- headers.merge!('Authorization' => "ApiKey #{@api_key}")
180
+ headers.merge!(header)
168
181
  @arguments[:transport_options].merge!(
169
182
  headers: headers
170
183
  )
171
- @arguments.delete(:user)
172
- @arguments.delete(:password)
184
+ end
185
+
186
+ def set_meta_header
187
+ return if @arguments[:enable_meta_header] == false
188
+
189
+ service, version = meta_header_service_version
190
+
191
+ meta_headers = {
192
+ service.to_sym => version,
193
+ rb: RUBY_VERSION,
194
+ t: Elasticsearch::Transport::VERSION
195
+ }
196
+ meta_headers.merge!(meta_header_engine) if meta_header_engine
197
+ meta_headers.merge!(meta_header_adapter) if meta_header_adapter
198
+
199
+ add_header({ 'x-elastic-client-meta' => meta_headers.map { |k, v| "#{k}=#{v}" }.join(',') })
200
+ end
201
+
202
+ def meta_header_service_version
203
+ if defined?(Elastic::META_HEADER_SERVICE_VERSION)
204
+ Elastic::META_HEADER_SERVICE_VERSION
205
+ elsif defined?(Elasticsearch::VERSION)
206
+ [:es, client_meta_version(Elasticsearch::VERSION)]
207
+ else
208
+ [:es, client_meta_version(Elasticsearch::Transport::VERSION)]
209
+ end
210
+ end
211
+
212
+ def client_meta_version(version)
213
+ regexp = /^([0-9]+\.[0-9]+\.[0-9]+)(\.?[a-z0-9.-]+)?$/
214
+ match = version.match(regexp)
215
+ return "#{match[1]}p" if (match[2])
216
+
217
+ version
218
+ end
219
+
220
+ def meta_header_engine
221
+ case RUBY_ENGINE
222
+ when 'ruby'
223
+ {}
224
+ when 'jruby'
225
+ { jv: ENV_JAVA['java.version'], jr: JRUBY_VERSION }
226
+ when 'rbx'
227
+ { rbx: RUBY_VERSION }
228
+ else
229
+ { RUBY_ENGINE.to_sym => RUBY_VERSION }
230
+ end
231
+ end
232
+
233
+ def meta_header_adapter
234
+ if @transport_class == Transport::HTTP::Faraday
235
+ {fd: Faraday::VERSION}.merge(
236
+ case @arguments[:adapter]
237
+ when :patron
238
+ {pt: Patron::VERSION}
239
+ when :net_http
240
+ {nh: defined?(Net::HTTP::VERSION) ? Net::HTTP::VERSION : Net::HTTP::HTTPVersion}
241
+ when :typhoeus
242
+ {ty: Typhoeus::VERSION}
243
+ when :httpclient
244
+ {hc: HTTPClient::VERSION}
245
+ when :net_http_persistent
246
+ {np: Net::HTTP::Persistent::VERSION}
247
+ end
248
+ )
249
+ elsif defined?(Transport::HTTP::Curb) && @transport_class == Transport::HTTP::Curb
250
+ {cl: Curl::CURB_VERSION}
251
+ elsif defined?(Transport::HTTP::Manticore) && @transport_class == Transport::HTTP::Manticore
252
+ {mc: Manticore::VERSION}
253
+ end
173
254
  end
174
255
 
175
256
  # Normalizes and returns hosts configuration.
@@ -4,6 +4,6 @@
4
4
 
5
5
  module Elasticsearch
6
6
  module Transport
7
- VERSION = '6.8.2'
7
+ VERSION = '6.8.3'
8
8
  end
9
9
  end
@@ -103,14 +103,13 @@ describe Elasticsearch::Transport::Client do
103
103
  end
104
104
  end
105
105
 
106
- context 'when the adapter is specified' do
107
-
106
+ context 'when the adapter is patron' do
108
107
  let(:adapter) do
109
108
  client.transport.connections.all.first.connection.builder.adapter
110
109
  end
111
110
 
112
111
  let(:client) do
113
- described_class.new(adapter: :patron)
112
+ described_class.new(adapter: :patron, enable_meta_header: false)
114
113
  end
115
114
 
116
115
  it 'uses Faraday with the adapter' do
@@ -118,14 +117,27 @@ describe Elasticsearch::Transport::Client do
118
117
  end
119
118
  end
120
119
 
121
- context 'when the adapter is specified as a string key' do
120
+ context 'when the adapter is typhoeus' do
121
+ let(:adapter) do
122
+ client.transport.connections.all.first.connection.builder.adapter
123
+ end
122
124
 
125
+ let(:client) do
126
+ described_class.new(adapter: :typhoeus, enable_meta_header: false)
127
+ end
128
+
129
+ it 'uses Faraday with the adapter' do
130
+ expect(adapter).to eq Faraday::Adapter::Typhoeus
131
+ end
132
+ end
133
+
134
+ context 'when the adapter is specified as a string key' do
123
135
  let(:adapter) do
124
136
  client.transport.connections.all.first.connection.builder.adapter
125
137
  end
126
138
 
127
139
  let(:client) do
128
- described_class.new('adapter' => :patron)
140
+ described_class.new('adapter' => :patron, enable_meta_header: false)
129
141
  end
130
142
 
131
143
  it 'uses Faraday with the adapter' do
@@ -218,7 +230,6 @@ describe Elasticsearch::Transport::Client do
218
230
  end
219
231
 
220
232
  context 'when credentials are specified' do
221
-
222
233
  let(:host) do
223
234
  'http://USERNAME:PASSWORD@myhost:8080'
224
235
  end
@@ -1020,6 +1031,33 @@ describe Elasticsearch::Transport::Client do
1020
1031
  expect(connections_after).to be >= (connections_before)
1021
1032
  end
1022
1033
  end
1034
+
1035
+ context 'when typhoeus is used as an adapter', unless: jruby? do
1036
+ before do
1037
+ require 'typhoeus'
1038
+ end
1039
+
1040
+ let(:options) do
1041
+ { adapter: :typhoeus }
1042
+ end
1043
+
1044
+ let(:adapter) do
1045
+ client.transport.connections.first.connection.builder.adapter
1046
+ end
1047
+
1048
+ it 'uses the patron connection handler' do
1049
+ expect(adapter).to eq('Faraday::Adapter::Typhoeus')
1050
+ end
1051
+
1052
+ it 'keeps connections open' do
1053
+ response = client.perform_request('GET', '_nodes/stats/http')
1054
+ connections_before = response.body['nodes'].values.find { |n| n['name'] == node_names.first }['http']['total_opened']
1055
+ client.transport.reload_connections!
1056
+ response = client.perform_request('GET', '_nodes/stats/http')
1057
+ connections_after = response.body['nodes'].values.find { |n| n['name'] == node_names.first }['http']['total_opened']
1058
+ expect(connections_after).to be >= (connections_before)
1059
+ end
1060
+ end
1023
1061
  end
1024
1062
  end
1025
1063
  end
@@ -0,0 +1,214 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ require 'spec_helper'
19
+
20
+ describe Elasticsearch::Transport::Client do
21
+ context 'meta-header' do
22
+ let(:subject) { client.transport.connections.first.connection.headers }
23
+ let(:client) { described_class.new }
24
+ let(:regexp) { /^[a-z]{1,}=[a-z0-9.\-]{1,}(?:,[a-z]{1,}=[a-z0-9._\-]+)*$/ }
25
+ let(:adapter) { :net_http }
26
+ let(:adapter_code) { "nh=#{defined?(Net::HTTP::VERSION) ? Net::HTTP::VERSION : Net::HTTP::HTTPVersion}" }
27
+ let(:meta_header) do
28
+ if jruby?
29
+ "es=#{meta_version},rb=#{RUBY_VERSION},t=#{Elasticsearch::Transport::VERSION},jv=#{ENV_JAVA['java.version']},jr=#{JRUBY_VERSION},fd=#{Faraday::VERSION},#{adapter_code}"
30
+ else
31
+ "es=#{meta_version},rb=#{RUBY_VERSION},t=#{Elasticsearch::Transport::VERSION},fd=#{Faraday::VERSION},#{adapter_code}"
32
+ end
33
+ end
34
+
35
+ context 'client_meta_version_' do
36
+ let(:version) { ['7.1.0-alpha', '7.11.0.pre.1', '8.0.0-beta', '8.0.0.beta.2']}
37
+
38
+ it 'converts the version to X.X.Xp' do
39
+ expect(client.send(:client_meta_version, '7.0.0-alpha')).to eq('7.0.0p')
40
+ expect(client.send(:client_meta_version, '7.11.0.pre.1')).to eq('7.11.0p')
41
+ expect(client.send(:client_meta_version, '8.1.0-beta')).to eq('8.1.0p')
42
+ expect(client.send(:client_meta_version, '8.0.0.beta.2')).to eq('8.0.0p')
43
+ expect(client.send(:client_meta_version, '12.16.4.pre')).to eq('12.16.4p')
44
+ end
45
+ end
46
+
47
+ # We are testing this method in the previous block, so now using it inside the test to make the
48
+ # Elasticsearch version in the meta header string dynamic
49
+ def meta_version
50
+ client.send(:client_meta_version, Elasticsearch::VERSION)
51
+ end
52
+
53
+ context 'single use of meta header' do
54
+ let(:client) do
55
+ described_class.new(adapter: adapter).tap do |klient|
56
+ allow(klient).to receive(:__build_connections)
57
+ end
58
+ end
59
+
60
+ it 'x-elastic-client-header value matches regexp' do
61
+ expect(subject['x-elastic-client-meta']).to match(regexp)
62
+ expect(subject).to include('x-elastic-client-meta' => meta_header)
63
+ end
64
+ end
65
+
66
+ context 'when using user-agent headers' do
67
+ let(:client) do
68
+ transport_options = { headers: { user_agent: 'My Ruby App' } }
69
+ described_class.new(transport_options: transport_options, adapter: adapter).tap do |klient|
70
+ allow(klient).to receive(:__build_connections)
71
+ end
72
+ end
73
+
74
+ it 'is friendly to previously set headers' do
75
+ expect(subject).to include(user_agent: 'My Ruby App')
76
+ expect(subject['x-elastic-client-meta']).to match(regexp)
77
+ expect(subject).to include('x-elastic-client-meta' => meta_header)
78
+ end
79
+ end
80
+
81
+ context 'when using API Key' do
82
+ let(:client) do
83
+ described_class.new(api_key: 'an_api_key', adapter: adapter)
84
+ end
85
+
86
+ let(:authorization_header) do
87
+ client.transport.connections.first.connection.headers['Authorization']
88
+ end
89
+
90
+ it 'adds the ApiKey header to the connection' do
91
+ expect(authorization_header).to eq('ApiKey an_api_key')
92
+ expect(subject['x-elastic-client-meta']).to match(regexp)
93
+ expect(subject).to include('x-elastic-client-meta' => meta_header)
94
+ end
95
+ end
96
+
97
+ context 'adapters' do
98
+ let(:meta_header) do
99
+ if jruby?
100
+ "es=#{meta_version},rb=#{RUBY_VERSION},t=#{Elasticsearch::Transport::VERSION},jv=#{ENV_JAVA['java.version']},jr=#{JRUBY_VERSION},fd=#{Faraday::VERSION}"
101
+ else
102
+ "es=#{meta_version},rb=#{RUBY_VERSION},t=#{Elasticsearch::Transport::VERSION},fd=#{Faraday::VERSION}"
103
+ end
104
+ end
105
+ let(:client) { described_class.new(adapter: adapter) }
106
+ let(:headers) { client.transport.connections.first.connection.headers }
107
+
108
+ context 'using net/http/persistent' do
109
+ let(:adapter) { :net_http_persistent }
110
+
111
+ it 'sets adapter in the meta header' do
112
+ require 'net/http/persistent'
113
+ expect(headers['x-elastic-client-meta']).to match(regexp)
114
+ meta = "#{meta_header},np=#{Net::HTTP::Persistent::VERSION}"
115
+ expect(headers).to include('x-elastic-client-meta' => meta)
116
+ end
117
+ end
118
+
119
+ context 'using httpclient' do
120
+ let(:adapter) { :httpclient }
121
+
122
+ it 'sets adapter in the meta header' do
123
+ require 'httpclient'
124
+ expect(headers['x-elastic-client-meta']).to match(regexp)
125
+ meta = "#{meta_header},hc=#{HTTPClient::VERSION}"
126
+ expect(headers).to include('x-elastic-client-meta' => meta)
127
+ end
128
+ end
129
+
130
+ context 'using typhoeus' do
131
+ let(:adapter) { :typhoeus }
132
+
133
+ it 'sets adapter in the meta header' do
134
+ require 'typhoeus'
135
+ expect(headers['x-elastic-client-meta']).to match(regexp)
136
+ meta = "#{meta_header},ty=#{Typhoeus::VERSION}"
137
+ expect(headers).to include('x-elastic-client-meta' => meta)
138
+ end
139
+ end
140
+
141
+ unless defined?(JRUBY_VERSION)
142
+ let(:adapter) { :patron }
143
+
144
+ context 'using patron' do
145
+ it 'sets adapter in the meta header' do
146
+ require 'patron'
147
+ expect(headers['x-elastic-client-meta']).to match(regexp)
148
+ meta = "#{meta_header},pt=#{Patron::VERSION}"
149
+ expect(headers).to include('x-elastic-client-meta' => meta)
150
+ end
151
+ end
152
+ end
153
+ end
154
+
155
+ if defined?(JRUBY_VERSION)
156
+ context 'when using manticore' do
157
+ let(:client) do
158
+ Elasticsearch::Client.new(transport_class: Elasticsearch::Transport::Transport::HTTP::Manticore)
159
+ end
160
+ let(:subject) { client.transport.connections.first.connection.instance_variable_get("@options")[:headers]}
161
+
162
+ it 'sets manticore in the metaheader' do
163
+ expect(subject['x-elastic-client-meta']).to match(regexp)
164
+ expect(subject['x-elastic-client-meta']).to match(/mc=[0-9.]+/)
165
+ end
166
+ end
167
+ else
168
+ context 'when using curb' do
169
+ let(:client) do
170
+ Elasticsearch::Client.new(transport_class: Elasticsearch::Transport::Transport::HTTP::Curb)
171
+ end
172
+
173
+ it 'sets curb in the metaheader' do
174
+ expect(subject['x-elastic-client-meta']).to match(regexp)
175
+ expect(subject['x-elastic-client-meta']).to match(/cl=[0-9.]+/)
176
+ end
177
+ end
178
+ end
179
+
180
+ context 'when using custom transport implementation' do
181
+ class MyTransport
182
+ include Elasticsearch::Transport::Transport::Base
183
+ def initialize(args); end
184
+ end
185
+ let(:client) { Elasticsearch::Client.new(transport_class: MyTransport) }
186
+ let(:subject){ client.instance_variable_get("@arguments")[:transport_options][:headers] }
187
+ let(:meta_header) do
188
+ if jruby?
189
+ "es=#{meta_version},rb=#{RUBY_VERSION},t=#{Elasticsearch::Transport::VERSION},jv=#{ENV_JAVA['java.version']},jr=#{JRUBY_VERSION}"
190
+ else
191
+ "es=#{meta_version},rb=#{RUBY_VERSION},t=#{Elasticsearch::Transport::VERSION}"
192
+ end
193
+ end
194
+
195
+ it 'doesnae set any info about the implementation in the metaheader' do
196
+ expect(subject['x-elastic-client-meta']).to match(regexp)
197
+ expect(subject).to include('x-elastic-client-meta' => meta_header)
198
+ end
199
+ end
200
+
201
+ context 'when using a different service version' do
202
+ before do
203
+ stub_const("Elastic::META_HEADER_SERVICE_VERSION", [:ent, '8.0.0'])
204
+ end
205
+
206
+ let(:client) { Elasticsearch::Client.new }
207
+
208
+ it 'sets the service version in the metaheader' do
209
+ expect(subject['x-elastic-client-meta']).to match(regexp)
210
+ expect(subject['x-elastic-client-meta']).to start_with('ent=8.0.0')
211
+ end
212
+ end
213
+ end
214
+ end
data/spec/spec_helper.rb CHANGED
@@ -8,6 +8,13 @@ require 'logger'
8
8
  require 'ansi/code'
9
9
  require 'hashie/mash'
10
10
  require 'pry-nav'
11
+ if defined?(JRUBY_VERSION)
12
+ require 'elasticsearch/transport/transport/http/manticore'
13
+ require 'pry-nav'
14
+ else
15
+ require 'elasticsearch/transport/transport/http/curb'
16
+ require 'curb'
17
+ end
11
18
 
12
19
  # The hosts to use for creating a elasticsearch client.
13
20
  #
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch-transport
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.8.2
4
+ version: 6.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karel Minarik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-29 00:00:00.000000000 Z
11
+ date: 2021-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
@@ -192,6 +192,20 @@ dependencies:
192
192
  - - ">="
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: httpclient
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
195
209
  - !ruby/object:Gem::Dependency
196
210
  name: minitest
197
211
  requirement: !ruby/object:Gem::Requirement
@@ -274,14 +288,14 @@ dependencies:
274
288
  requirements:
275
289
  - - "~>"
276
290
  - !ruby/object:Gem::Version
277
- version: '0.6'
291
+ version: '1.4'
278
292
  type: :development
279
293
  prerelease: false
280
294
  version_requirements: !ruby/object:Gem::Requirement
281
295
  requirements:
282
296
  - - "~>"
283
297
  - !ruby/object:Gem::Version
284
- version: '0.6'
298
+ version: '1.4'
285
299
  - !ruby/object:Gem::Dependency
286
300
  name: curb
287
301
  requirement: !ruby/object:Gem::Requirement
@@ -341,7 +355,7 @@ dependencies:
341
355
  description: 'Ruby client for Elasticsearch. See the `elasticsearch` gem for full
342
356
  integration.
343
357
 
344
- '
358
+ '
345
359
  email:
346
360
  - karel.minarik@elasticsearch.org
347
361
  executables: []
@@ -374,6 +388,7 @@ files:
374
388
  - lib/elasticsearch/transport/version.rb
375
389
  - spec/elasticsearch/transport/base_spec.rb
376
390
  - spec/elasticsearch/transport/client_spec.rb
391
+ - spec/elasticsearch/transport/meta_header_spec.rb
377
392
  - spec/elasticsearch/transport/sniffer_spec.rb
378
393
  - spec/spec_helper.rb
379
394
  - test/integration/transport_test.rb
@@ -412,13 +427,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
412
427
  - !ruby/object:Gem::Version
413
428
  version: '0'
414
429
  requirements: []
415
- rubygems_version: 3.1.2
430
+ rubygems_version: 3.1.4
416
431
  signing_key:
417
432
  specification_version: 4
418
433
  summary: Ruby client for Elasticsearch.
419
434
  test_files:
420
435
  - spec/elasticsearch/transport/base_spec.rb
421
436
  - spec/elasticsearch/transport/client_spec.rb
437
+ - spec/elasticsearch/transport/meta_header_spec.rb
422
438
  - spec/elasticsearch/transport/sniffer_spec.rb
423
439
  - spec/spec_helper.rb
424
440
  - test/integration/transport_test.rb