Class: Elasticsearch::Transport::Transport::HTTP::Manticore
- Inherits:
-
Object
- Object
- Elasticsearch::Transport::Transport::HTTP::Manticore
- Defined in:
- lib/logstash/inputs/elasticsearch/patches/_elasticsearch_transport_http_manticore.rb
Instance Method Summary collapse
Instance Method Details
#apply_headers(request_options, options) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/logstash/inputs/elasticsearch/patches/_elasticsearch_transport_http_manticore.rb', line 20 def apply_headers(, ) headers = ( && [:headers]) || {} headers[CONTENT_TYPE_STR] = find_value(headers, CONTENT_TYPE_REGEX) || DEFAULT_CONTENT_TYPE # this code is necessary to grab the correct user-agent header # when this method is invoked with apply_headers(@request_options, options) # from https://github.com/elastic/elasticsearch-ruby/blob/v7.14.0/elasticsearch-transport/lib/elasticsearch/transport/transport/http/manticore.rb#L113-L114 transport_user_agent = nil if ( && [:transport_options] && [:transport_options][:headers]) transport_headers = [:transport_options][:headers] transport_user_agent = find_value(transport_headers, USER_AGENT_REGEX) end headers[USER_AGENT_STR] = transport_user_agent || find_value(headers, USER_AGENT_REGEX) || user_agent_header headers[ACCEPT_ENCODING] = GZIP if use_compression? ([:headers] ||= {}).merge!(headers) # this line was changed end |