Sha256: cc22aeb583af54232d1f15f24e7dd3092949a02dff119c2a459bfe4c2bea7be7

Contents?: true

Size: 548 Bytes

Versions: 3

Compression:

Stored size: 548 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.split('_').collect(&:capitalize).join, field_hash[f]]}.to_h
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
request-tracer-0.7.0 lib/request_tracer/integration/base.rb
request-tracer-0.6.6 lib/request_tracer/integration/base.rb
request-tracer-0.6.5 lib/request_tracer/integration/base.rb