Sha256: 2340047ce31f05eb188c59516ef6bdbd0c5f8664afe58585704ee278b804f3d2

Contents?: true

Size: 528 Bytes

Versions: 1

Compression:

Stored size: 528 Bytes

Contents

require_relative 'base'
require_relative '../trace'
require 'faraday'

module RequestTracer
  module Integration
    module FaradayHandler
      extend self
      def activate
        ::Faraday::Middleware.register_middleware tracing: FaradayTracing
      end
    end
    class FaradayTracing < ::Faraday::Middleware
      include Base
      def call(env)
        Trace.record do |trace|
          env[:request_headers].merge!(extract_headers_from_fields(trace))
          @app.call(env)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
request-tracer-0.7.0 lib/request_tracer/integration/faraday_handler.rb