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



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/karafka/web/pro/ui/lib/search/matchers/raw_header_includes.rb', line 47

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