spec/elasticsearch/transport/client_spec.rb in elasticsearch-transport-7.6.0 vs spec/elasticsearch/transport/client_spec.rb in elasticsearch-transport-7.7.0.pre

- old
+ new

@@ -1127,11 +1127,23 @@ it 'uses X-Opaque-Id in the header' do allow(client).to receive(:perform_request) { OpenStruct.new(body: '') } expect { client.search(opaque_id: 'opaque_id') }.not_to raise_error expect(client).to have_received(:perform_request) - .with('GET', '_search', { opaque_id: 'opaque_id' }, nil) + .with('GET', '_search', { opaque_id: 'opaque_id' }, nil, {}) end + end + end + + context 'when a header is set on an endpoint request' do + let(:client) { described_class.new(host: hosts) } + let(:headers) { { 'user-agent' => 'my ruby app' } } + + it 'performs the request with the header' do + allow(client).to receive(:perform_request) { OpenStruct.new(body: '') } + expect { client.search(headers: headers) }.not_to raise_error + expect(client).to have_received(:perform_request) + .with('GET', '_search', {}, nil, headers) end end end context 'when the client connects to Elasticsearch' do