Module: Railsmith::CrossDomainWarningFormatter

Defined in:
lib/railsmith/cross_domain_warning_formatter.rb

Overview

Stable, log- and CI-friendly renderings of cross-domain warning payloads.

Constant Summary collapse

CANONICAL_KEYS =
%i[
  event
  context_domain
  service_domain
  service
  action
  strict_mode
  blocking
  occurred_at
].freeze

Class Method Summary collapse

Class Method Details

.as_json_line(payload) ⇒ Object

Single-line JSON with sorted keys for grep and log aggregation.



22
23
24
# File 'lib/railsmith/cross_domain_warning_formatter.rb', line 22

def as_json_line(payload)
  JSON.generate(ordered_hash(payload))
end

.as_key_value_line(payload) ⇒ Object

Space-separated key=value for quick human scanning (values are JSON-encoded).



27
28
29
# File 'lib/railsmith/cross_domain_warning_formatter.rb', line 27

def as_key_value_line(payload)
  (canonical_kv_parts(payload) + extra_kv_parts(payload)).join(" ")
end