Class: Faraday::MsHeaderTrail

Inherits:
Middleware
  • Object
show all
Defined in:
lib/faraday/ms_header_trail.rb

Overview

Public: Faraday middleware that stores audit data local thread into http header request

Examples

Faraday.new(configuration.host) do |builder|
  builder.use Faraday::MsHeaderTrail

Constant Summary collapse

RESPONSE_HEADER_PREFIX =
"X-"

Instance Method Summary collapse

Constructor Details

#initialize(app, options = nil) ⇒ MsHeaderTrail

Returns a new instance of MsHeaderTrail.



18
19
20
21
# File 'lib/faraday/ms_header_trail.rb', line 18

def initialize(app, options = nil)
  super
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



23
24
25
26
27
28
# File 'lib/faraday/ms_header_trail.rb', line 23

def call(env)
  ::MsHeaderTrail.retrieve.each_pair do |key, value|
    set_header(env, key, value)
  end
  @app.call(env)
end