Class: Faraday::Conductivity::RequestId

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

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ RequestId

Returns a new instance of RequestId.



5
6
7
# File 'lib/faraday/conductivity/request_id.rb', line 5

def initialize(app)
  super(app)
end

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/faraday/conductivity/request_id.rb', line 9

def call(env)
  request_id = Thread.current[:request_id]
  if request_id
    env[:request_headers]['X-Request-Id'] ||= request_id
  end
  @app.call(env)
end