File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
elasticsearch-transport/lib/elasticsearch/transport/transport Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -371,12 +371,12 @@ def host_unreachable_exceptions
371371
372372 def apply_headers ( client , options )
373373 headers = options [ :headers ] || { }
374- headers [ CONTENT_TYPE_STR ] = find_key_value ( headers , CONTENT_TYPE_REGEX ) || DEFAULT_CONTENT_TYPE
375- headers [ USER_AGENT_STR ] = find_key_value ( headers , USER_AGENT_REGEX ) || user_agent_header ( client )
374+ headers [ CONTENT_TYPE_STR ] = find_value ( headers , CONTENT_TYPE_REGEX ) || DEFAULT_CONTENT_TYPE
375+ headers [ USER_AGENT_STR ] = find_value ( headers , USER_AGENT_REGEX ) || user_agent_header ( client )
376376 client . headers . merge! ( headers )
377377 end
378378
379- def find_key_value ( hash , regex )
379+ def find_value ( hash , regex )
380380 key_value = hash . find { |k , v | k . to_s . downcase =~ regex }
381381 if key_value
382382 hash . delete ( key_value [ 0 ] )
Original file line number Diff line number Diff line change @@ -156,8 +156,8 @@ def host_unreachable_exceptions
156156
157157 def apply_headers ( request_options , options )
158158 headers = ( options && options [ :headers ] ) || { }
159- headers [ CONTENT_TYPE_STR ] = find_key_value ( headers , CONTENT_TYPE_REGEX ) || DEFAULT_CONTENT_TYPE
160- headers [ USER_AGENT_STR ] = find_key_value ( headers , USER_AGENT_REGEX ) || user_agent_header
159+ headers [ CONTENT_TYPE_STR ] = find_value ( headers , CONTENT_TYPE_REGEX ) || DEFAULT_CONTENT_TYPE
160+ headers [ USER_AGENT_STR ] = find_value ( headers , USER_AGENT_REGEX ) || user_agent_header
161161 request_options . merge! ( headers : headers )
162162 end
163163
You can’t perform that action at this time.
0 commit comments