Class: Karafka::Web::Pro::Ui::Lib::Search::Matchers::RawHeaderIncludes

Inherits:
Base
  • Object
show all
Defined in:
lib/karafka/web/pro/ui/lib/search/matchers/raw_header_includes.rb

Overview

Note:

It is case sensitive

Note:

Ignores encoding issues

Matcher that searches in the raw headers. If any header key or value matches the phrase, it is true. Otherwise false.

Instance Method Summary collapse

Methods inherited from Base

active?, name

Instance Method Details

#call(message, phrase) ⇒ Boolean

Returns does message raw headers contain the phrase.

Parameters:

  • message (Karafka::Messages::Message)
  • phrase (String)

Returns:

  • (Boolean)

    does message raw headers contain the phrase



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/karafka/web/pro/ui/lib/search/matchers/raw_header_includes.rb', line 22

def call(message, phrase)
  message.raw_headers.each do |raw_header_key, raw_header_value|
    return true if safe_include?(raw_header_key, phrase)

    if raw_header_value.is_a?(Array)
      raw_header_value.each do |raw_header_sub_value|
        return true if safe_include?(raw_header_sub_value, phrase)
      end
    elsif safe_include?(raw_header_value, phrase)
      return true
    end
  end

  false
end