Sha256: 53ac39c4ddcc5245b1fcbe5ba177fb53731f7a90bc988da0697bb883a3d8e147

Contents?: true

Size: 489 Bytes

Versions: 8

Compression:

Stored size: 489 Bytes

Contents

# frozen_string_literal: true

require "kiev/config"
require "kiev/subrequest_helper"

module Kiev
  module Kafka
    class ContextInjector
      # @param [Hash] headers Injects context headers
      # @return [Hash]
      def call(headers = {})
        Kiev::SubrequestHelper.payload.each do |key, value|
          field_key = Kiev::Config::DEFAULT_HTTP_PROPAGATED_FIELDS.fetch(key.to_sym, key)
          headers[field_key] = value
        end
        headers
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
kiev-4.9.0 lib/kiev/kafka/context_injector.rb
kiev-4.8.3 lib/kiev/kafka/context_injector.rb
kiev-4.8.2 lib/kiev/kafka/context_injector.rb
kiev-4.8.1 lib/kiev/kafka/context_injector.rb
kiev-4.8.0 lib/kiev/kafka/context_injector.rb
kiev-4.7.0 lib/kiev/kafka/context_injector.rb
kiev-4.6.0 lib/kiev/kafka/context_injector.rb
kiev-4.5.0 lib/kiev/kafka/context_injector.rb