Skip to content

Commit c56e671

Browse files
committed
[API] Test Runner: Stringify header keys, do not overwrite headers if set
1 parent cca3498 commit c56e671

File tree

2 files changed

+3
-0
lines changed
  • api-spec-testing/test_file
  • elasticsearch-transport/lib/elasticsearch/transport

2 files changed

+3
-0
lines changed

api-spec-testing/test_file/action.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ def execute(client, test = nil)
7373
if headers[:Authorization] == 'Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA=='
7474
headers.delete(:Authorization)
7575
end
76+
# Stringify keys:
77+
headers = headers.transform_keys(&:to_s)
7678
if ENV['QUIET'] == 'true'
7779
# todo: create a method on Elasticsearch::Client that can clone the client with new options
7880
Elasticsearch::Client.new(

elasticsearch-transport/lib/elasticsearch/transport/client.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ def set_api_key
208208

209209
def set_compatibility_header
210210
return unless ['1', 'true'].include?(ENV['ELASTIC_CLIENT_APIVERSIONING'])
211+
return if instance_variable_get('@options').dig(:transport_options, :headers, 'Accept')
211212

212213
add_header(
213214
{

0 commit comments

Comments
 (0)