Sha256: f18833a94d9ced83aac574c3dd27e78bad8722065005abe134032227d6811d7f

Contents?: true

Size: 531 Bytes

Versions: 2

Compression:

Stored size: 531 Bytes

Contents

module RequestTracer
  module Integration
    module Base
      HEADER_REGEX = /HTTP_X_B3_(.*)/
      def extract_fields_from_headers(header_hash)
        header_hash.map do |k,v|
          special_header = HEADER_REGEX.match(k)
          special_header && [B3_REQUIRED_FIELDS_FROM_SHORT_NAMES[special_header[1].downcase], v]
        end.compact.to_h
      end
      def extract_headers_from_fields(field_hash)
        B3_REQUIRED_FIELDS.map {|f| ["X_B3_" + f.gsub("_", "").upcase, field_hash[f]]}.to_h
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
request-tracer-0.6.4 lib/request_tracer/integration/base.rb
request-tracer-0.6.3 lib/request_tracer/integration/base.rb