elasticsearch 8.5.0 → 8.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/elasticsearch.gemspec +1 -1
- data/lib/elasticsearch/version.rb +1 -1
- data/lib/elasticsearch.rb +2 -3
- data/spec/unit/api_key_spec.rb +37 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d59206ff2dab0663aec31ad0c64ef8dd7c2044d885299d201b41e187ecfa4245
|
4
|
+
data.tar.gz: 5d34b264085c2d0ba2dd57d85b60e1685fc2985bdf4fccb55ebd9dfece865067
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40248c01429f3464b1582a27f5cfde5a701ddbc2aa15fd224610b681e5221f5e7a341129757e86470688fced7fe5e66d96406b0d30b1686b0b9396f209e3a763
|
7
|
+
data.tar.gz: e26757d22fccdbed3cf140c375760d85d585432a3f083c298d3371795c311f405fdd49aa181e4139027399b94c95e0c02faec5a2429933f53d4578b18b9fa546
|
data/elasticsearch.gemspec
CHANGED
@@ -46,7 +46,7 @@ Gem::Specification.new do |s|
|
|
46
46
|
s.required_ruby_version = '>= 2.5'
|
47
47
|
|
48
48
|
s.add_dependency 'elastic-transport', '~> 8'
|
49
|
-
s.add_dependency 'elasticsearch-api', '8.5.
|
49
|
+
s.add_dependency 'elasticsearch-api', '8.5.1'
|
50
50
|
|
51
51
|
s.add_development_dependency 'bundler'
|
52
52
|
s.add_development_dependency 'byebug' unless defined?(JRUBY_VERSION) || defined?(Rubinius)
|
data/lib/elasticsearch.rb
CHANGED
@@ -144,9 +144,8 @@ module Elasticsearch
|
|
144
144
|
if (headers = arguments.dig(:transport_options, :headers))
|
145
145
|
headers.merge!(authorization)
|
146
146
|
else
|
147
|
-
arguments[:transport_options]
|
148
|
-
|
149
|
-
}
|
147
|
+
arguments[:transport_options] ||= {}
|
148
|
+
arguments[:transport_options].merge!({ headers: authorization })
|
150
149
|
end
|
151
150
|
end
|
152
151
|
|
data/spec/unit/api_key_spec.rb
CHANGED
@@ -57,7 +57,7 @@ describe Elasticsearch::Client do
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
-
context 'when other headers
|
60
|
+
context 'when other headers were specified' do
|
61
61
|
let(:client) do
|
62
62
|
described_class.new(
|
63
63
|
api_key: 'elasticsearch_api_key',
|
@@ -72,6 +72,42 @@ describe Elasticsearch::Client do
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
+
context 'when sending transport_options but no headers were specified' do
|
76
|
+
let(:client) do
|
77
|
+
described_class.new(
|
78
|
+
api_key: 'elasticsearch_api_key',
|
79
|
+
transport_options: { ssl: { verify: false } }
|
80
|
+
)
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'Adds the ApiKey header to the connection and keeps the options' do
|
84
|
+
header = client.transport.connections.first.connection.headers
|
85
|
+
expect(header['Authorization']).to eq('ApiKey elasticsearch_api_key')
|
86
|
+
expect(client.transport.options[:transport_options]).to include({ ssl: { verify: false } })
|
87
|
+
expect(client.transport.options[:transport_options][:headers]).to include('Authorization' => 'ApiKey elasticsearch_api_key')
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
context 'when other headers and options were specified' do
|
92
|
+
let(:client) do
|
93
|
+
described_class.new(
|
94
|
+
api_key: 'elasticsearch_api_key',
|
95
|
+
transport_options: {
|
96
|
+
headers: { 'x-test-header' => 'test' },
|
97
|
+
ssl: { verify: false }
|
98
|
+
}
|
99
|
+
)
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'Adds the ApiKey header to the connection and keeps the header' do
|
103
|
+
header = client.transport.connections.first.connection.headers
|
104
|
+
expect(header['X-Test-Header']).to eq('test')
|
105
|
+
expect(header['Authorization']).to eq('ApiKey elasticsearch_api_key')
|
106
|
+
expect(client.transport.options[:transport_options]).to include({ ssl: { verify: false } })
|
107
|
+
expect(client.transport.options[:transport_options][:headers]).to include('Authorization' => 'ApiKey elasticsearch_api_key')
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
75
111
|
context 'Metaheader' do
|
76
112
|
let(:adapter_code) { "nh=#{defined?(Net::HTTP::VERSION) ? Net::HTTP::VERSION : Net::HTTP::HTTPVersion}" }
|
77
113
|
let(:meta_header) do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elasticsearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.5.
|
4
|
+
version: 8.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karel Minarik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-11-
|
11
|
+
date: 2022-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: elastic-transport
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 8.5.
|
33
|
+
version: 8.5.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 8.5.
|
40
|
+
version: 8.5.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|